Chinx Posted March 23, 2009 Share Posted March 23, 2009 Hi, I'm new to PHP and this forum. I'd appreciate help on correcting my contact form... I have two files. One called contact.php (with design and fields) the other contact_code.php (with php code) Following code is on the design page: <form method="post" action="contact_code.php"> <table align=left> <tr> <td width="362" class="contact-text"></td> <td width="20"></td> </tr> <tr> <td class="contact-text">Your Name</td></tr> <td><input size=45 name="fName"></td> </tr> <tr> <td class="contact-text">Email:</td></tr> <td><input size=45 name="Email"></td> </tr> <tr> <td class="contact-text">Phone:</td></tr> <td><input size=25 name="Phone"></td> </tr> <tr> <td colspan=2 class="contact-text">Message:</td></tr> <tr><td colspan=2 align=left> <textarea name="Message" rows=7 cols=45></textarea></td> </tr> <tr> <td colspan=2 align=left> <input type=submit name="send" value="Submit"></td> </tr> </table> </form> ---------- Following code is on the code page: <?php $to = $_REQUEST['sendto'] ; $from = $_REQUEST['Email'] ; $fname = $_REQUEST['fName'] ; $headers = "From: $Email"; $subject = "A message through invoridesign.com"; $fields = array(); $fields{"fName"} = "fName"; $fields{"Email"} = "Email"; $fields{"Phone"} = "Phone"; $fields{"Message"} = "Message"; $body = "We have received the following information: "; foreach($fields as $a => $b) { $body .= sprintf("%20s: %s ",$b,$_REQUEST[$a]); } $headers2 = "From: chinxthejinx@yahoo.com"; $subject2 = "Thank you for contacting us"; $autoreply = "Thank you for contacting us"; if($from == '') {print "You have not entered an email, please go back and try again";} else { if($fname == '') {print "You have not entered a first name, please go back and try again";} else { $send = mail($to, $subject, $body, $headers); $send2 = mail($from, $subject2, $autoreply, $headers2); if($send) {header( "Location: http://www.invirodesign.com" );} else {print "We encountered an error sending your mail, please notify rachu_red_p@yahoo.com"; } } } ?> When I post these pages online and check the form by sending myself an email, I get the following error: We encountered an error sending your mail, please notify chinxthejinx@yahoo.com Thank you[/] Link to comment https://forums.phpfreaks.com/topic/150638-simple-contact-form-not-working/ Share on other sites More sharing options...
trq Posted March 23, 2009 Share Posted March 23, 2009 I'm new to PHP and this forum. I'd appreciate help on correcting my contact form... Try asking in a relevent board. Did you need see this.... This is NOT a help forum! in the description of this board? Link to comment https://forums.phpfreaks.com/topic/150638-simple-contact-form-not-working/#findComment-791361 Share on other sites More sharing options...
Recommended Posts