/ Published in: PHP
processes contact form input and produces an auto reply
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php $fields{"Name"} = "Name"; $fields{"Email"} = "Email"; $fields{"Message"} = "Message"; $from = $_REQUEST['Email'] ; $name = $_REQUEST['Name'] ; $headers = "From: $from"; $subject = "NCCDC Web contact -- From contact page"; $body = "WEB CONTACT FROM NCCDC \n\n We have received the following information:\n\n"; foreach($fields as $a => $b){ $body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); } /*Second email */ $subject2 = "Thank you for contacting NCCDC"; $autoreply = "Thank you for contacting us. Somebody will get back to you as soon as possible, usually within 48 hours. If you have any more questions, please consult our website at www.pdxchild.org"; $autoreply .= "\n\n You Wrote: \n".$_REQUEST["Message"]; if($from == '') {print "You have not entered an email, please go back and try again";} else { if($name == '') {print "You have not entered a name, please go back and try again";} else { if($send) else } } ?>