Created
March 19, 2016 21:08
-
-
Save rushdimohamed09/91751227ffdc1b3cd886 to your computer and use it in GitHub Desktop.
This file contains 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
<?php | |
$action=$_REQUEST['action']; | |
if ($action=="") /* display the contact form */ | |
{ | |
?> | |
<form action="contact.php" method="POST" enctype="multipart/form-data"> | |
<input type="hidden" name="action" value="submit"> | |
Your name:<br> | |
<input name="name" type="text" value="" size="30"/><br> | |
Your email:<br> | |
<input name="email" type="text" value="" size="30"/><br> | |
Your message:<br> | |
<textarea name="message" rows="7" cols="30"></textarea><br> | |
<input type="submit" name="submit" value="Send email"/> | |
</form> | |
<?php | |
} | |
else /* send the submitted data */ | |
{ | |
$name=$_REQUEST['name']; | |
$email=$_REQUEST['email']; | |
$message=$_REQUEST['message']; | |
if (($name=="")||($email=="")||($message=="")) | |
{ | |
echo "All fields are required, please fill <a href=\'\'>the form</a> again."; | |
} | |
else{ | |
$from="From:". $name."".$email."\r\nReturn-path: ".$email; | |
$subject="Message sent using your contact form"; | |
mail("[email protected]", $subject, $message, $from); | |
echo "Email sent!"; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment