Jump to content

php feedback form need help


runnerjp

Recommended Posts

hey i have inserted a feedback form into my webpage www.werun2win.com/contact
it 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 :S


bellow 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 = "[email protected]" ;

$mailto = '[email protected]' ;

// $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 ;

?>
Link to comment
https://forums.phpfreaks.com/topic/12241-php-feedback-form-need-help/
Share on other sites

[!--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" );

to

header("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 work

if 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??
eregi for email

[code]
<?

$email="[email protected]";

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]
[!--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="[email protected]";

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???
try this ok

[code]

<?

$mailto = '[email protected]';

$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]
[!--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 = '[email protected]';

$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 now

Parse error: syntax error, unexpected ':', expecting ',' or ';' in /home/werun2wi/public_html/feedback.php on line 22



do i put the script feedback.php

or 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?
[!--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]
[!--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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.