Create a gist now

Instantly share code, notes, and snippets.

anonymous /Contact.php
Created Mar 19, 2013

What would you like to do?
These are the only codes i am using to create the contact form at the minute.
$field_name = $_POST['cf_name'];
$field_email = $_POST['cf_email'];
$field_message = $_POST['cf_message'];
$mail_to = '';
$subject = 'Message from a site visitor '.$field_name;
$body_message = 'From: '.$field_name."\n";
$body_message .= 'E-mail: '.$field_email."\n";
$body_message .= 'Message: '.$field_message;
$headers = 'From: '.$field_email."\r\n";
$headers .= 'Reply-To: '.$field_email."\r\n";
$mail_status = mail($mail_to, $subject, $body_message, $headers);
if ($mail_status) { ?>
<script language="javascript" type="text/javascript">
alert('Thank you for the message. I will contact you as soon as possible.');
document.location = ''
else { ?>
<script language="javascript" type="text/javascript">
alert('Message failed. Please, send an email to');
document.location = ''
<div id="fifth">
<div class="scrollblock3">
<div class="contact-left">
<form action="contact.php" method="post">
<font style="background-color: black;">Your name: </font><br>
<input type="text" name="cf_name"><br>
<font style="background-color: black;">Your e-mail: </font><br>
<input type="text" name="cf_email"><br>
<font style="background-color: black;">Message: </font><br>
<textarea name="cf_message" rows="12" cols="60"></textarea><br><br>
<input type="submit" value="Send">
<input type="reset" value="Clear">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment