-
-
Save panphora/34e675a6246e196a82230715b87729ed to your computer and use it in GitHub Desktop.
Super simple PHP contact form in one file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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('[email protected]', "Contact from My Website", $message, $headers) | |
echo "Thank you for contacting us!<br /><br />"; | |
} | |
?> | |
<form action="" method="post"> | |
<div> | |
<div><label for="name">Name:</label></div> | |
<input id="name" type="text" name="name" /> | |
</div> | |
<div> | |
<div><label for="email">Email:</label></div> | |
<input id="email" type="email" name="email" /> | |
</div> | |
<div> | |
<div><label for="message">Message:</label></div> | |
<textarea id="message" name="message" cols="50" rows="5"></textarea> | |
</div> | |
<div> | |
<input type="submit" value="Submit"> | |
</div> | |
</form> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment