Skip to content

Instantly share code, notes, and snippets.

@wgdm
Created July 23, 2013 12:53
Show Gist options
  • Save wgdm/6062129 to your computer and use it in GitHub Desktop.
Save wgdm/6062129 to your computer and use it in GitHub Desktop.
<!-- HTML PART - goes on contact.html or the html page of your choosing.-->
<form action="submit.php" method="POST">
<dl>
<dt>Name:
<dd><input type="text" placeholder="John Doe" name="name">
<dt>Email Address:
<dd><input type="text" placeholder="john@doe.com" name="mail">
<dt>Message:
<dd><textarea rows="8" cols="26" name="message">
</textarea>
</dl>
<p><input type="submit" class="btn btn-success"></p>
</form>
<!-- END HTML PART -->
<!-- PHP PART - for data processing. -->
<?php $name = $_POST['name'];
$email = $_POST['mail'];
$message = $_POST['message'];
$formcontent="From: $name \n Message: $message";
$recipient = "youremail@yourdomain.com";
$subject = "Contact Form";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
echo "<p>Thanks for the Message $name</p>";
echo "<p>We will reply usually within 24 hours.</p>";
?>
<!-- END PHP PART -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment