Skip to content

Instantly share code, notes, and snippets.

Created March 19, 2013 22:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/5200669 to your computer and use it in GitHub Desktop.
Save anonymous/5200669 to your computer and use it in GitHub Desktop.
These are the only codes i am using to create the contact form at the minute.
<?php
$field_name = $_POST['cf_name'];
$field_email = $_POST['cf_email'];
$field_message = $_POST['cf_message'];
$mail_to = 'mail@markblackler.com';
$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 = 'http://www.markblackler.com'
</script>
<?php
}
else { ?>
<script language="javascript" type="text/javascript">
alert('Message failed. Please, send an email to mail@markblackler.com');
document.location = 'http://www.markblackler.com'
</script>
<?php
}
?>
<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">
</form>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment