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 = "[email protected]";$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 ? 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 = "[email protected]";$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] 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. 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] 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. 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. 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 ? 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 = "[email protected]";$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] 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 [email protected]I tried this - $to = "[email protected]";"[email protected]";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 ? 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 = "[email protected], [email protected]";[/code] Link to comment https://forums.phpfreaks.com/topic/31300-help-with-feedback-form/#findComment-144900 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.