Skip to content

Instantly share code, notes, and snippets.

@libryder
Created June 21, 2012 21:16
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save libryder/2968583 to your computer and use it in GitHub Desktop.
Save libryder/2968583 to your computer and use it in GitHub Desktop.
Super simple PHP contact form in one file
<html>
<head>
<title>Contact Us</title>
</head>
<body>
<?php
if ($_POST['message']) {
$message = $_POST['message'];
$email = $_POST['email'];
$name = $_POST['name'];
$headers = "From: ".$name."<".$email.">";
mail('justinaiken@gmail.com', "Contact from RRR", $message, $headers)
echo "Thanks for contacting us!<br /><br />";
}
?>
<form action="" method="post">
Name<br />
<input type="text" name="name" /> <br />
Email<br />
<input type="text" name="email" /><br /><br />
Message<br />
<textarea name="message" cols="50" rows="5"></textarea>
</form>
</body>
</html>
@m3mojax
Copy link

m3mojax commented Nov 29, 2018

missed submit button

<p><input type="submit" value="Send it!"></p>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment