Skip to content

Instantly share code, notes, and snippets.



Forked from libryder/contact.php
Last active Jan 9, 2019
What would you like to do?
Super simple PHP contact form in one file
<title>Contact Us</title>
if ($_POST['message']) {
$message = $_POST['message'];
$email = $_POST['email'];
$name = $_POST['name'];
$headers = "From: ".$name."<".$email.">";
mail('', "Contact from My Website", $message, $headers)
echo "Thank you for contacting us!<br /><br />";
<form action="" method="post">
<div><label for="name">Name:</label></div>
<input id="name" type="text" name="name" />
<div><label for="email">Email:</label></div>
<input id="email" type="email" name="email" />
<div><label for="message">Message:</label></div>
<textarea id="message" name="message" cols="50" rows="5"></textarea>
<input type="submit" value="Submit">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.