Jump to content


Photo

php feedback form need help


  • Please log in to reply
18 replies to this topic

#1 runnerjp

runnerjp
  • Members
  • PipPipPip
  • Advanced Member
  • 2,214 posts

Posted 17 June 2006 - 02:15 PM

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...m/contact.html" ;
$errorurl = "http://www.werun2win...com/error.html" ;
$thankyouurl = "http://www.werun2win...om/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 ;

?>

#2 aebstract

aebstract
  • Members
  • PipPipPip
  • Advanced Member
  • 1,105 posts

Posted 17 June 2006 - 02:35 PM

change

header( "Location: $thankyouurl" );

to

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

There is an area of the mind that could be called unsane, beyond sanity, and yet
not insane. Think of a circle with a fine split in it. At one end there's
insanity. You go around the circle to sanity, and on the other end of the
circle, close to insanity, but not insanity, is unsanity.


#3 runnerjp

runnerjp
  • Members
  • PipPipPip
  • Advanced Member
  • 2,214 posts

Posted 17 June 2006 - 02:45 PM

[!--quoteo(post=384977:date=Jun 17 2006, 09:35 AM:name=aebstract)--][div class=\'quotetop\']QUOTE(aebstract @ Jun 17 2006, 09:35 AM) View Post[/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??

#4 aebstract

aebstract
  • Members
  • PipPipPip
  • Advanced Member
  • 1,105 posts

Posted 17 June 2006 - 02:49 PM

I just sent a test mail and got sent to the thanks page O.o

There is an area of the mind that could be called unsane, beyond sanity, and yet
not insane. Think of a circle with a fine split in it. At one end there's
insanity. You go around the circle to sanity, and on the other end of the
circle, close to insanity, but not insanity, is unsanity.


#5 runnerjp

runnerjp
  • Members
  • PipPipPip
  • Advanced Member
  • 2,214 posts

Posted 17 June 2006 - 02:52 PM

did you...how comes on my computer i gt sent to the .php page??

#6 aebstract

aebstract
  • Members
  • PipPipPip
  • Advanced Member
  • 1,105 posts

Posted 17 June 2006 - 02:53 PM

maybe you need to refresh on your contact page or something? Then fill it out?

There is an area of the mind that could be called unsane, beyond sanity, and yet
not insane. Think of a circle with a fine split in it. At one end there's
insanity. You go around the circle to sanity, and on the other end of the
circle, close to insanity, but not insanity, is unsanity.


#7 runnerjp

runnerjp
  • Members
  • PipPipPip
  • Advanced Member
  • 2,214 posts

Posted 17 June 2006 - 02:57 PM

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

#8 aebstract

aebstract
  • Members
  • PipPipPip
  • Advanced Member
  • 1,105 posts

Posted 17 June 2006 - 02:58 PM

I've never learned how.

There is an area of the mind that could be called unsane, beyond sanity, and yet
not insane. Think of a circle with a fine split in it. At one end there's
insanity. You go around the circle to sanity, and on the other end of the
circle, close to insanity, but not insanity, is unsanity.


#9 runnerjp

runnerjp
  • Members
  • PipPipPip
  • Advanced Member
  • 2,214 posts

Posted 17 June 2006 - 02:59 PM

sweet ...thanks for all your help... if i get stuck again with anything would it be ok if i contacted you?


#10 aebstract

aebstract
  • Members
  • PipPipPip
  • Advanced Member
  • 1,105 posts

Posted 17 June 2006 - 03:02 PM

sure

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


msn: aebstract@gmail.com
aim: aebstract

There is an area of the mind that could be called unsane, beyond sanity, and yet
not insane. Think of a circle with a fine split in it. At one end there's
insanity. You go around the circle to sanity, and on the other end of the
circle, close to insanity, but not insanity, is unsanity.


#11 runnerjp

runnerjp
  • Members
  • PipPipPip
  • Advanced Member
  • 2,214 posts

Posted 17 June 2006 - 03:04 PM

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

#12 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 17 June 2006 - 03:26 PM

eregi for email

<?

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

}
?>


valadate form postings.
if(($name=="none")&&($comments=="none")){
echo "Sorry please fill in all the form<br><a href='http://whatever.com'>Please try agin!</a>":
exit;
}

Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#13 runnerjp

runnerjp
  • Members
  • PipPipPip
  • Advanced Member
  • 2,214 posts

Posted 17 June 2006 - 03:42 PM

[!--quoteo(post=384997:date=Jun 17 2006, 10:26 AM:name=redarrow)--][div class=\'quotetop\']QUOTE(redarrow @ Jun 17 2006, 10:26 AM) View Post[/div][div class=\'quotemain\'][!--quotec--]
eregi for email

<?

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

}
?>
valadate form postings.
if(($name=="none")&&($comments=="none")){
echo "Sorry please fill in all the form<br><a href='http://whatever.com'>Please try agin!</a>":
exit;
}
[/quote]

ok where abouts do i add them into my script???


#14 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 17 June 2006 - 04:01 PM

try this ok


<?

$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;
}
?>

Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#15 runnerjp

runnerjp
  • Members
  • PipPipPip
  • Advanced Member
  • 2,214 posts

Posted 17 June 2006 - 04:13 PM

[!--quoteo(post=385002:date=Jun 17 2006, 11:01 AM:name=redarrow)--][div class=\'quotetop\']QUOTE(redarrow @ Jun 17 2006, 11:01 AM) View Post[/div][div class=\'quotemain\'][!--quotec--]
try this ok


<?

$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;
}
?>
[/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?

#16 runnerjp

runnerjp
  • Members
  • PipPipPip
  • Advanced Member
  • 2,214 posts

Posted 17 June 2006 - 04:29 PM

please can any one help me its very annoying ...

#17 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 17 June 2006 - 04:48 PM

[!--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

<?

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

}
?>




This is the form fully tested ok.

call this mail_form.php


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

Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#18 runnerjp

runnerjp
  • Members
  • PipPipPip
  • Advanced Member
  • 2,214 posts

Posted 17 June 2006 - 05:21 PM

case closed

#19 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 17 June 2006 - 05:27 PM

[!--quoteo(post=385020:date=Jun 17 2006, 05:21 PM:name=runnerjp)--][div class=\'quotetop\']QUOTE(runnerjp @ Jun 17 2006, 05:21 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
case closed
[/quote]

copy the code agin i chaged it ok good luck mate
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users