bengaluru Posted December 20, 2006 Share Posted December 20, 2006 Can somebody help me with this php.This is the simplest php form getting feedback from my visitors. I have the same form on my other site and it is working fine. But nowworking with my new site.My form is fine. I am having trouble with the response. The problem is that whenever a user completes the form, instead of the "thank you", the No response page is displayed and no email is received by me. the page that is displayed (No response) says that the user has not completed all the fields and hence the response is not sent.--------------------------------------------------------------- This is my php <?if (($name == "") && ($email == "") && ($comments == "")) {header("Location: http://www.mysite.com/noresponse.htm");exit;}$msg = "E-MAIL SENT FROM $email\n";$msg .= "Sender's Name: $name\n";$msg .= "Sender's E-Mail: $email\n";$msg .= "Sender's Place: $place\n";$msg .= "Message: $comments\n\n";$to = "myname@gmail.com";$subject = " Feedback";$mailheaders = "From: Response Forms <> \n";$mailheaders .= "Reply-To: $email\n\n";mail($to, $subject, $msg, $mailheaders);?><HTML><HEAD><TITLE>My site - Thank You</TITLE><meta http-equiv="refresh" content="10;url=http://www.mysite.com/contactus.htm"></HEAD><BODY><p><img src="images/banner.jpg" width="446" height="100"><img src="images/shubha.jpg" width="354" height="100"></p> <hr><H1>Thank you. Your response is valuable to us.</H1><P><strong>Your Name:</strong><? echo "$name"; ?><P><strong>Your E-Mail Address:</strong><? echo "$email"; ?><P><strong>You are from:</strong><? echo "$place"; ?><P><strong>Message:</strong> <? echo "$comments"; ?><H3>Please wait and you will be taken back to the page you were viewing</H3></BODY></HTML>-------------------------------------------------------------------------------------------Any help ? Quote Link to comment https://forums.phpfreaks.com/topic/31300-help-with-feedback-form/ Share on other sites More sharing options...
marcus Posted December 20, 2006 Share Posted December 20, 2006 [code]<?phpif (!isset($name) || !isset($email) || !isset($comments)) {header("Location: http://www.mysite.com/noresponse.htm");exit;}else {$msg = "E-MAIL SENT FROM $email\n";$msg .= "Sender's Name: $name\n";$msg .= "Sender's E-Mail: $email\n";$msg .= "Sender's Place: $place\n";$msg .= "Message: $comments\n\n";$to = "myname@gmail.com";$subject = " Feedback";$mailheaders = "From: Response Forms <> \n";$mailheaders .= "Reply-To: $email\n\n";$send = mail($to, $subject, $msg, $mailheaders); if($send){?><HTML><HEAD><TITLE>My site - Thank You</TITLE><meta http-equiv="refresh" content="10;url=http://www.mysite.com/contactus.htm"></HEAD><BODY><p><img src="images/banner.jpg" width="446" height="100"><img src="images/shubha.jpg" width="354" height="100"></p> <H1>Thank you. Your response is valuable to us.</H1><P><strong>Your Name:</strong><? echo "$name"; ?><P><strong>Your E-Mail Address:</strong><? echo "$email"; ?><P><strong>You are from:</strong><? echo "$place"; ?><P><strong>Message:</strong><? echo "$comments"; ?><H3>Please wait and you will be taken back to the page you were viewing</H3></BODY></HTML><?php }else { echo "your mail was not delivered"; }}?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/31300-help-with-feedback-form/#findComment-144854 Share on other sites More sharing options...
bengaluru Posted December 20, 2006 Author Share Posted December 20, 2006 Thanks. But does not work either. I am getting the No response page still. Quote Link to comment https://forums.phpfreaks.com/topic/31300-help-with-feedback-form/#findComment-144857 Share on other sites More sharing options...
marcus Posted December 20, 2006 Share Posted December 20, 2006 Try defining $name, $email and $comments at the top[code]<?php$name = $_POST['name'];$email = $_POST['email'];$comments = $_POST['comments'];?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/31300-help-with-feedback-form/#findComment-144858 Share on other sites More sharing options...
bengaluru Posted December 20, 2006 Author Share Posted December 20, 2006 sorry I did not understand. Quote Link to comment https://forums.phpfreaks.com/topic/31300-help-with-feedback-form/#findComment-144861 Share on other sites More sharing options...
marcus Posted December 20, 2006 Share Posted December 20, 2006 Well, automatically it's trying to find the values, but they are undefined. Quote Link to comment https://forums.phpfreaks.com/topic/31300-help-with-feedback-form/#findComment-144862 Share on other sites More sharing options...
bengaluru Posted December 20, 2006 Author Share Posted December 20, 2006 No my php is giving errors with your code. Can U post the exact code that I should be using like you did before. Thanks so much for your help.But what I dont understand is the same php works fine in my other site and why does it not work now ?What am I doing wrong ? Quote Link to comment https://forums.phpfreaks.com/topic/31300-help-with-feedback-form/#findComment-144863 Share on other sites More sharing options...
marcus Posted December 20, 2006 Share Posted December 20, 2006 [code=php:0]<?php$name = $_POST[name];$email = $_POST[email];$comments = $_POST[comments];if (!isset($name) || !isset($email) || !isset($comments)) {header("Location: http://www.mysite.com/noresponse.htm");exit;}else {$msg = "E-MAIL SENT FROM $email\n";$msg .= "Sender's Name: $name\n";$msg .= "Sender's E-Mail: $email\n";$msg .= "Sender's Place: $place\n";$msg .= "Message: $comments\n\n";$to = "myname@gmail.com";$subject = " Feedback";$mailheaders = "From: Response Forms <> \n";$mailheaders .= "Reply-To: $email\n\n";$send = mail($to, $subject, $msg, $mailheaders);?><HTML><HEAD><TITLE>My site - Thank You</TITLE><meta http-equiv="refresh" content="10;url=http://www.mysite.com/contactus.htm"></HEAD><BODY><p><img src="images/banner.jpg" width="446" height="100"><img src="images/shubha.jpg" width="354" height="100"></p> <H1>Thank you. Your response is valuable to us.</H1><P><strong>Your Name:</strong><? echo "$name"; ?><P><strong>Your E-Mail Address:</strong><? echo "$email"; ?><P><strong>You are from:</strong><? echo "$place"; ?><P><strong>Message:</strong><? echo "$comments"; ?><H3>Please wait and you will be taken back to the page you were viewing</H3></BODY></HTML><?php}?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/31300-help-with-feedback-form/#findComment-144866 Share on other sites More sharing options...
bengaluru Posted December 20, 2006 Author Share Posted December 20, 2006 Thanks my friend. It worked.One more question : what if I have to get the response at 2 email id's.right now it says =myname@gmail.comI tried this - $to = "myname@gmail.com";"yourname@gmail.com";But it does not work. 2. for some reason the Place of the sender is not diaplayed both at the thank You page and the email that I receive. You know why ? Quote Link to comment https://forums.phpfreaks.com/topic/31300-help-with-feedback-form/#findComment-144887 Share on other sites More sharing options...
scottrohe Posted December 20, 2006 Share Posted December 20, 2006 try [code=php:0]$to = "myname@gmail.com, yourname@gmail.com";[/code] Quote Link to comment https://forums.phpfreaks.com/topic/31300-help-with-feedback-form/#findComment-144900 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.