Skip to content

Instantly share code, notes, and snippets.

@louismullie
Created March 12, 2012 13:47
Show Gist options
  • Save louismullie/2022030 to your computer and use it in GitHub Desktop.
Save louismullie/2022030 to your computer and use it in GitHub Desktop.
PHP Mail Form
<!-- CONTACT.HTML -->
<form method='post' action='mailform.php'>
Email: <input name='email' type='text' /><br />
Subject: <input name='subject' type='text' /><br />
Message:<br />
<textarea name='message' rows='15' cols='40'>
</textarea><br />
<input type='submit' />
</form>
<!-- MAILFORM.PHP -->
<?php
if (isset($_REQUEST['email'])) {
$email = $_REQUEST['email'] ;
$subject = $_REQUEST['subject'] ;
$message = $_REQUEST['message'] ;
mail("someone@example.com", $subject,
$message, "From:" . $email);
echo "Merci! Votre requête a été soumise à notre webmestre.";
} else {
echo "Erreur: Prière de remplir le formulaire.";
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment