Skip to content

Instantly share code, notes, and snippets.

@JGallardo
Created December 2, 2012 09:15
Show Gist options
  • Save JGallardo/4187880 to your computer and use it in GitHub Desktop.
Save JGallardo/4187880 to your computer and use it in GitHub Desktop.
html form for my site (in review)
<form action="send.php" class="form-horizontal" method="post" name="contact_form">
<fieldset>
<div class='control-group'>
<label class='control-label' for='name'>Name</label>
<div class='controls'>
<input class='input-xlarge' name="name" id='name' type='text' />
</div>
</div>
<div class='control-group'>
<label class='control-label' for='email'>Email</label>
<div class='controls'>
<input class='input-xlarge' name="email" id='email' type='text' />
</div>
</div>
<div class='control-group'>
<label class='control-label' for='message'>Message</label>
<div class='controls'>
<textarea class='input-xlarge' name="message" id='message' rows='3'></textarea>
</div>
</div>
<div class='control-group'>
<div class='controls'>
<input name="submitted" id="submitted" value="Send" class='btn btn-primary' type="submit" />
</div>
</div>
</fieldset>
</form>
<script type="text/javascript">
//<![CDATA[
$(document).ready(function ()
{
$("#form").validate();
});
});
//]]>
</script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<?php
//print_r($_POST);
$to = "[email protected]";
$name = $_POST["name"];
$email = $_POST["email"];
$phone = $_POST["phone"];
$url = $_POST["url"];
$message = $_POST["message"];
$text = "NAME: $name<br>
EMAIL: $email<br>
URL: $url<br>
MESSAGE: $message";
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html; charset=utf-8" . "\r\n";
$headers .= "From: <$email>" . "\r\n";
mail($to, "Message from ".$name, $text, $headers);
?>
Thank you, your email has been sent.
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment