Jump to content

Help Please


lbnja

Recommended Posts

I have tried to keep it simple but without success.

The following code returns to the originating web page, not the THANKYOU page, and it does not send the email.

I'm new to php and I must have missed something. Can anyone help me ?

 

<?php

$thankyouurl = "http://www.bidets4sale.com/THANKYOU.htm" ;

$mailto = '[email protected]' ;

$subject = "FEEDBACK" ;

$selected_radio = $_POST['how'];

$keyword = $_POST['keyword'] ;

$consent = $_POST['consent'] ;

$name = $_POST['name'] ;

$mail = $_POST['mail'] ;

$comments = $_POST['comments'] ;

$messageproper =

"This message was sent from:\n" .

"Name of sender: $name\n" .

"Email of sender: $mail\n" .

"How did I find website : $selected_radio\n" .

"$consent\n" .

"$keyword\n" .

"$comments\n" .;

{ mail($mailto, $subject, $messageproper);}

header( "Location: $thankyouurl" ); exit ;

Link to comment
https://forums.phpfreaks.com/topic/122285-help-please/
Share on other sites

Change these lines:

"$comments\n" .;
{ mail($mailto, $subject, $messageproper);}
header( "Location: $thankyouurl" ); exit ;

 

to:

<?php
"$comments\n"; //removed the last dot as you weren't concatenating anything
mail($mailto, $subject, $messageproper); //removed the curly braces
header('Location: thankyou.html'); //i used a relative path and you should use it if the file isn't hosted somewhere remotely
?>

 

Consider also adding some headers, clearly described in the manual.

Link to comment
https://forums.phpfreaks.com/topic/122285-help-please/#findComment-631433
Share on other sites

Thank you for your suggestions.   

I changed the code as follows but I still have both problems occuring.

 

<?php

$thankyouurl = 'http://www.bidets4sale.com/THANKYOU.htm' ;

$mailto = "[email protected]" ;

$subject = "FEEDBACK" ;

$selected_radio = $_POST['how'];

$keyword = $_POST['keyword'] ;

$consent = $_POST['consent'] ;

$name = $_POST['name'] ;

$mail = $_POST['mail'] ;

$comments = $_POST['comments'] ;

$messageproper =

"This message was sent from:\n" .

"Name of sender: $name\n" .

"Email of sender: $mail\n" .

"How did I find website : $selected_radio\n" .

"$consent\n" .

"$keyword\n" .

"$comments\n" ;

mail($mailto, $subject, $messageproper);

header( 'Location: http://www.bidets4sale.com/THANKYOU.htm' );

?>

Link to comment
https://forums.phpfreaks.com/topic/122285-help-please/#findComment-631630
Share on other sites

Is your form actually submitting? Can you print the user entered input to the screen after the form has been posted to test.

Also your mail function is missing the mail headers. Check out the mail() function on php.net for a description of mail headers.

Link to comment
https://forums.phpfreaks.com/topic/122285-help-please/#findComment-631781
Share on other sites

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.