| | | | PHP Contact Form | | | Times viewed: 22653 Rating: 5/10 |
|
Looking for a form for your contact page. Well heres a simple and easy code which will make your contacting page an easier way of making. Open any type of text editor for example, Notepad and copy and paste this code and save it as mail.php:
"<?php //variables (change these)
$youremail = "name@domain.com"; // your email address
$subject = "Contact"; // the subject of the email
$thankyou = "thankyou.php"; // thank you page
// don't change anything else
;if($email == ""){ ?> No email address added. Please go back.<br/> "<?php ;}elseif($name == ""){ "?> No name added. Please go back.<br/> <?php ;}elseif($message == ""){ "?> No message added. Please go back.<br/> "<?php ;}else{
$msg = ereg_replace("\\\'", "'", $message); $msg = ereg_replace('\\\"', "\"", $msg); $message1 = "from: $name\nemail: $email\nmessage:\n$msg1";
mail($youremail, $subject, $msg, "From: $email\r\nReply-to: $email\r\n"); ?> <meta http-equiv="refresh" content="0; url=<?echo $thankyou;?>""> "<?php } "?>
*You don't have to have a thank you page if you dont need it you can just make it index.php or whatever page*
Now for the form:
<form action="mail.php" method="post"> Name <input type="text" name="name"><br/> Email addess <input type="text" name="email"><br/> Message<br/> <textarea name="message" cols="40" rows="5"></textarea><br/> <input type="submit" value="send"><br/> </form>
**If you are unfimiliar with <br/> it's the new HTML standard.**
|
|