runnerjp Posted June 17, 2006 Share Posted June 17, 2006 hey i have inserted a feedback form into my webpage www.werun2win.com/contactit send me the email when you fill it in fine but when you click subit buttin you get redirected to www.werun2win.com/feedbackform.php which is not what i told it to do i said to redirect the person to a thankyou page i have made.. www.werun2win.com/thankyou so what i wrong :Sbellow is the php script i added to my directory on my host server*/// ------------- CONFIGURABLE SECTION ------------------------// $mailto - set to the email address you want the form// sent to, eg//$mailto = "youremailaddress@example.com" ;$mailto = 'contact@werun2win.com' ;// $subject - set to the Subject line of the email, eg//$subject = "Feedback Form" ;$subject = "werun2win.com" ;// the pages to be displayed, eg//$formurl = "" ;//$errorurl = "" ;//$thankyouurl = "" ;$formurl = "http://www.werun2win.com/contact.html" ;$errorurl = "http://www.werun2win.com/error.html" ;$thankyouurl = "http://www.werun2win.com/thanks.html" ;$uself = 0;// -------------------- END OF CONFIGURABLE SECTION ---------------$headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n" ;$name = $_POST['name'] ;$email = $_POST['email'] ;$comments = $_POST['comments'] ;$http_referrer = getenv( "HTTP_REFERER" );if (!isset($_POST['email'])) { header( "Location: $formurl" ); exit ;}if (empty($name) || empty($email) || empty($comments)) { header( "Location: $errorurl" ); exit ;}if ( ereg( "[\r\n]", $name ) || ereg( "[\r\n]", $email ) ) { header( "Location: $errorurl" ); exit ;}if (get_magic_quotes_gpc()) { $comments = stripslashes( $comments );}$messageproper = "This message was sent from:\n" . "$http_referrer\n" . "------------------------------------------------------------\n" . "Name of sender: $name\n" . "Email of sender: $email\n" . "------------------------- COMMENTS -------------------------\n\n" . $comments . "\n\n------------------------------------------------------------\n" ;mail($mailto, $subject, $messageproper, "From: \"$name\" <$email>" . $headersep . "Reply-To: \"$name\" <$email>" . $headersep . "X-Mailer: chfeedback.php 2.07" );header( "Location: $thankyouurl" );exit ;?> Quote Link to comment https://forums.phpfreaks.com/topic/12241-php-feedback-form-need-help/ Share on other sites More sharing options...
aebstract Posted June 17, 2006 Share Posted June 17, 2006 change header( "Location: $thankyouurl" );toheader("Location: [a href=\"http://www.werun2win.com/thanks.html");\" target=\"_blank\"]http://www.werun2win.com/thanks.html");[/a] Quote Link to comment https://forums.phpfreaks.com/topic/12241-php-feedback-form-need-help/#findComment-46665 Share on other sites More sharing options...
runnerjp Posted June 17, 2006 Author Share Posted June 17, 2006 [!--quoteo(post=384977:date=Jun 17 2006, 09:35 AM:name=aebstract)--][div class=\'quotetop\']QUOTE(aebstract @ Jun 17 2006, 09:35 AM) [snapback]384977[/snapback][/div][div class=\'quotemain\'][!--quotec--]change header( "Location: $thankyouurl" );toheader("Location: [a href=\"http://www.werun2win.com/thanks.html");\" target=\"_blank\"]http://www.werun2win.com/thanks.html");[/a][/quote]i tried it and it didnt seem to workif u need to look at the website and what it does go [a href=\"http://www.werun2win.com/contact.html\" target=\"_blank\"]here[/a]have i not enterd the php script into the system right or summats ??i put it itno the public_html file where the contact page i made is...is that right?? Quote Link to comment https://forums.phpfreaks.com/topic/12241-php-feedback-form-need-help/#findComment-46667 Share on other sites More sharing options...
aebstract Posted June 17, 2006 Share Posted June 17, 2006 I just sent a test mail and got sent to the thanks page O.o Quote Link to comment https://forums.phpfreaks.com/topic/12241-php-feedback-form-need-help/#findComment-46669 Share on other sites More sharing options...
runnerjp Posted June 17, 2006 Author Share Posted June 17, 2006 did you...how comes on my computer i gt sent to the .php page?? Quote Link to comment https://forums.phpfreaks.com/topic/12241-php-feedback-form-need-help/#findComment-46670 Share on other sites More sharing options...
aebstract Posted June 17, 2006 Share Posted June 17, 2006 maybe you need to refresh on your contact page or something? Then fill it out? Quote Link to comment https://forums.phpfreaks.com/topic/12241-php-feedback-form-need-help/#findComment-46672 Share on other sites More sharing options...
runnerjp Posted June 17, 2006 Author Share Posted June 17, 2006 at least it works...thanks loads for your help...just woundering 1 more thingi want to add a fileupload part so people can send me pictures of them self so i can creat profiles of them... will it be hard adding i think so i can upload pictures??? Quote Link to comment https://forums.phpfreaks.com/topic/12241-php-feedback-form-need-help/#findComment-46673 Share on other sites More sharing options...
aebstract Posted June 17, 2006 Share Posted June 17, 2006 I've never learned how. Quote Link to comment https://forums.phpfreaks.com/topic/12241-php-feedback-form-need-help/#findComment-46674 Share on other sites More sharing options...
runnerjp Posted June 17, 2006 Author Share Posted June 17, 2006 sweet ...thanks for all your help... if i get stuck again with anything would it be ok if i contacted you? Quote Link to comment https://forums.phpfreaks.com/topic/12241-php-feedback-form-need-help/#findComment-46675 Share on other sites More sharing options...
aebstract Posted June 17, 2006 Share Posted June 17, 2006 sureedit: if yu have msn/aim go ahead and msg me if you need more help:msn: aebstract@gmail.comaim: aebstract Quote Link to comment https://forums.phpfreaks.com/topic/12241-php-feedback-form-need-help/#findComment-46677 Share on other sites More sharing options...
runnerjp Posted June 17, 2006 Author Share Posted June 17, 2006 OK I HAVE GOT 1 MORE QUESTIONok i want to make it so people have to fill in all the fields and in the email section it has to be a @ email addressyou saw how easy it was by putting test in it just to put anythingdo you know of a way i can do this?? Quote Link to comment https://forums.phpfreaks.com/topic/12241-php-feedback-form-need-help/#findComment-46678 Share on other sites More sharing options...
redarrow Posted June 17, 2006 Share Posted June 17, 2006 eregi for email[code]<?$email="me@me.com";if(!eregi("^[a-z0-9_]+@[a-z0-9\-]+\.[a-z0-9\-\.]+$" ,$email)) {echo"please add a correct email address<br><a href='http://whatever.com'>Please try agin!</a>":exit;}else{code here when correct.............}?>[/code]valadate form postings.[code]if(($name=="none")&&($comments=="none")){echo "Sorry please fill in all the form<br><a href='http://whatever.com'>Please try agin!</a>":exit;}[/code] Quote Link to comment https://forums.phpfreaks.com/topic/12241-php-feedback-form-need-help/#findComment-46685 Share on other sites More sharing options...
runnerjp Posted June 17, 2006 Author Share Posted June 17, 2006 [!--quoteo(post=384997:date=Jun 17 2006, 10:26 AM:name=redarrow)--][div class=\'quotetop\']QUOTE(redarrow @ Jun 17 2006, 10:26 AM) [snapback]384997[/snapback][/div][div class=\'quotemain\'][!--quotec--]eregi for email[code]<?$email="me@me.com";if(!eregi("^[a-z0-9_]+@[a-z0-9\-]+\.[a-z0-9\-\.]+$" ,$email)) {echo"please add a correct email address<br><a href='http://whatever.com'>Please try agin!</a>":exit;}else{code here when correct.............}?>[/code]valadate form postings.[code]if(($name=="none")&&($comments=="none")){echo "Sorry please fill in all the form<br><a href='http://whatever.com'>Please try agin!</a>":exit;}[/code][/quote]ok where abouts do i add them into my script??? Quote Link to comment https://forums.phpfreaks.com/topic/12241-php-feedback-form-need-help/#findComment-46687 Share on other sites More sharing options...
redarrow Posted June 17, 2006 Share Posted June 17, 2006 try this ok[code]<?$mailto = 'contact@werun2win.com';$subject = "werun2win.com";$formurl = "http://www.werun2win.com/contact.html";$thankyouurl = "http://www.werun2win.com/thanks.html";$uself = 0;$headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n";$name = $_POST['name'];$email = $_POST['email'];$comments = $_POST['comments'];$http_referrer = getenv( "HTTP_REFERER" );if((!$name=="none")&&($comments=="none")){echo "Sorry please fill in all the form<br><a href='what ever form page is called'>Please try agin!</a>":exit;}if (get_magic_quotes_gpc()) {$comments = stripslashes( $comments );}$messageproper ="This message was sent from:\n" ."$http_referrer\n" ."------------------------------------------------------------\n" ."Name of sender: $name\n" ."Email of sender: $email\n" ."------------------------- COMMENTS -------------------------\n\n" .$comments ."\n\n------------------------------------------------------------\n";if(!eregi("^[a-z0-9_]+@[a-z0-9\-]+\.[a-z0-9\-\.]+$" ,$email)) {echo"please add a correct email address<br><a href='what ever form page is called.php'>Please try agin!</a>":exit;}else{mail($mailto, $subject, $messageproper,"From: \"$name\" <$email>" . $headersep . "Reply-To: \"$name\" <$email>" . $headersep . "X-Mailer: chfeedback.php 2.07" );header( "Location: $thankyouurl" );exit;}?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/12241-php-feedback-form-need-help/#findComment-46690 Share on other sites More sharing options...
runnerjp Posted June 17, 2006 Author Share Posted June 17, 2006 [!--quoteo(post=385002:date=Jun 17 2006, 11:01 AM:name=redarrow)--][div class=\'quotetop\']QUOTE(redarrow @ Jun 17 2006, 11:01 AM) [snapback]385002[/snapback][/div][div class=\'quotemain\'][!--quotec--]try this ok[code]<?$mailto = 'contact@werun2win.com';$subject = "werun2win.com";$formurl = "http://www.werun2win.com/contact.html";$thankyouurl = "http://www.werun2win.com/thanks.html";$uself = 0;$headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n";$name = $_POST['name'];$email = $_POST['email'];$comments = $_POST['comments'];$http_referrer = getenv( "HTTP_REFERER" );if((!$name=="none")&&($comments=="none")){echo "Sorry please fill in all the form<br><a href='what ever form page is called'>Please try agin!</a>":exit;}if (get_magic_quotes_gpc()) {$comments = stripslashes( $comments );}$messageproper ="This message was sent from:\n" ."$http_referrer\n" ."------------------------------------------------------------\n" ."Name of sender: $name\n" ."Email of sender: $email\n" ."------------------------- COMMENTS -------------------------\n\n" .$comments ."\n\n------------------------------------------------------------\n";if(!eregi("^[a-z0-9_]+@[a-z0-9\-]+\.[a-z0-9\-\.]+$" ,$email)) {echo"please add a correct email address<br><a href='what ever form page is called.php'>Please try agin!</a>":exit;}else{mail($mailto, $subject, $messageproper,"From: \"$name\" <$email>" . $headersep . "Reply-To: \"$name\" <$email>" . $headersep . "X-Mailer: chfeedback.php 2.07" );header( "Location: $thankyouurl" );exit;}?>[/code][/quote]i inserted it and it says this nowParse error: syntax error, unexpected ':', expecting ',' or ';' in /home/werun2wi/public_html/feedback.php on line 22do i put the script feedback.phpor do i put www.werun2win.com/contact ( this is where user fills out the fields) in the areas u told my to put the adress in? Quote Link to comment https://forums.phpfreaks.com/topic/12241-php-feedback-form-need-help/#findComment-46694 Share on other sites More sharing options...
runnerjp Posted June 17, 2006 Author Share Posted June 17, 2006 please can any one help me its very annoying ... Quote Link to comment https://forums.phpfreaks.com/topic/12241-php-feedback-form-need-help/#findComment-46701 Share on other sites More sharing options...
redarrow Posted June 17, 2006 Share Posted June 17, 2006 [!--sizeo:5--][span style=\"font-size:18pt;line-height:100%\"][!--/sizeo--]edited try it know ok[!--sizec--][/span][!--/sizec--]This code has been fully tested please fill in the relevent information ok.Call this mail.php[code]<?$mailto ="Add you email address please ok";$subject ="Add you subject title please";$uself = 0;$headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n";$name = $_POST['name'];$email = $_POST['email'];$comments = $_POST['comments'];$http_referrer = getenv( "HTTP_REFERER" );if((!$name=="none")&&($comments=="none")){echo"<br>Sorry please fill in all the form<br><a href='mail_form.php'>Please try agin</a><br>";exit;}if (get_magic_quotes_gpc()) {$comments = stripslashes( $comments );}$messageproper ="This message was sent from:\n" ."$http_referrer\n" ."------------------------------------------------------------\n" ."Name of sender: $name\n" ."Email of sender: $email\n" ."------------------------- COMMENTS -------------------------\n\n" .$comments ."\n\n------------------------------------------------------------\n";if(!eregi("^[a-z0-9_]+@[a-z0-9\-]+\.[a-z0-9\-\.]+$" ,$email)) {echo"please add a correct email address<br><a href='mail_form.php'>Please try agin!</a>";exit;}else{mail($mailto, $subject, $messageproper,"From: \"$name\" <$email>" . $headersep . "Reply-To: \"$name\" <$email>" . $headersep . "X-Mailer: chfeedback.php 2.07" );echo"<br><br><table align='center' border='4' bordercolor='black'><td align='center'>Thank you message receved<br>please use this link to goto the main page<a href='http://www.homepage.com'> Click here!</a></table></td>";}?>[/code]This is the form fully tested ok.call this mail_form.php[code]<html><body bgcolor="blue"><table align="center" border="4" bordercolor="black"><td align="center"><form method="post" action="mail.php"><input type="hidden" name="mailto"><input type="hidden" name="subject"><br>Name<br><input type="text" name="name"><br><br>Email address<br><input type="text" name="email"><br><br>Comment<br><textarea name="comments" cols="20" rows="20"></textarea><br><br><input type="submit" value="send message"></form></td></table></body></html>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/12241-php-feedback-form-need-help/#findComment-46704 Share on other sites More sharing options...
runnerjp Posted June 17, 2006 Author Share Posted June 17, 2006 case closed Quote Link to comment https://forums.phpfreaks.com/topic/12241-php-feedback-form-need-help/#findComment-46708 Share on other sites More sharing options...
redarrow Posted June 17, 2006 Share Posted June 17, 2006 [!--quoteo(post=385020:date=Jun 17 2006, 05:21 PM:name=runnerjp)--][div class=\'quotetop\']QUOTE(runnerjp @ Jun 17 2006, 05:21 PM) [snapback]385020[/snapback][/div][div class=\'quotemain\'][!--quotec--]case closed[/quote]copy the code agin i chaged it ok good luck mate Quote Link to comment https://forums.phpfreaks.com/topic/12241-php-feedback-form-need-help/#findComment-46709 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.