Results 1 to 1 of 1
Thread: PHP Contact Us Page
-
PHP Contact Us Page
17 May 2012 @ 12.19 Hi here I have shared how to create contact us page on PHP
This code will turn out out a form (that you can change) and the php code at the top will process the email. Of course, you may want to add captcha for bot protection, etc.Code:<?phpif($_POST["action"] === "submit_contact") { $emailto = "youremail@youremail.com"; // Set this to the email you want to receive the contact form $subject = "New Contact Request"; // Set this to the subject line for the email $_POST["name"] = filter_var($_POST["name"], FILTER_SANITIZE_EMAIL); // Sanitize field input $_POST["email"] = filter_var($_POST["email"], FILTER_SANITIZE_EMAIL); // Sanitize field input $_POST["phone"] = filter_var($_POST["phone"], FILTER_SANITIZE_EMAIL); // Sanitize field input $_POST["comments"] = filter_var($_POST["comments"], FILTER_SANITIZE_EMAIL); // Sanitize field input $comments = "NAME: " . $_POST["name"] . "\n EMAIL: " . $_POST["email"] . "\n PHONE: " . $_POST["phone"] . "\n\n COMMENTS:\n" . $_POST["comments"] . "\n"; $headers = "From: " . $_POST["email"] . "\r\n"; $headers .= "X-Identification: ECS-Mk1-B\r\n"; $headers .= "MIME-Version: 1.0\n"; $headers .= "Content-Type: text/plain; charset=\"iso-8859-1\"\n"; $headers .= "Content-Transfer-Encoding: 7bit\n\n"; $sendtheemail = mail($emailto, $subject, $comments . "\n\n", $headers); } ?> <form action="<?php echo $_SERVER["PHP_SELF"] ?>" name="contact_form" method="post"> <input type="hidden" name="action" value="submit_contact" /> <input type="text" name="name" /> Your Name<br /> <input type="text" name="email" /> Your Email<br /> <input type="text" name="phone" /> Your Phone<br /><br /> Your Comments<br /> <textarea name="comments" style="width:300px;height:100px;"></textarea> <input type="submit" name="submit_email" value="Send Email" /> </form>
Hope this will help you



LinkBack URL
About LinkBacks












Displaying Search Results
Agree with you.... Generally, we don't have control over display...