public
anonymous / Contact.php
Created

These are the only codes i am using to create the contact form at the minute.

  • Download Gist
Contact.php
PHP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
<?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
}
?>
gistfile1.html
HTML
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
<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>

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.