Jump to content

Archived

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

runnerjp

php feedback form need help

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 = "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 ;

?>

Share this post


Link to post
Share on other sites
change

header( "Location: $thankyouurl" );

to

header("Location: [a href=\"http://www.werun2win.com/thanks.html");\" target=\"_blank\"]http://www.werun2win.com/thanks.html");[/a]

Share this post


Link to post
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??

Share this post


Link to post
Share on other sites
at least it works...thanks loads for your help...just woundering 1 more thing

i 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???

Share this post


Link to post
Share on other sites
sweet ...thanks for all your help... if i get stuck again with anything would it be ok if i contacted you?

Share this post


Link to post
Share on other sites
sure

edit: if yu have msn/aim go ahead and msg me if you need more help:


msn: aebstract@gmail.com
aim: aebstract

Share this post


Link to post
Share on other sites
OK I HAVE GOT 1 MORE QUESTION

ok 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 address

you saw how easy it was by putting test in it just to put anything

do you know of a way i can do this??

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
[!--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???

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
[!--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 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?

Share this post


Link to post
Share on other sites
[!--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]

Share this post


Link to post
Share on other sites
[!--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

Share this post


Link to post
Share on other sites

×

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.