Jump to content

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 = 'feedback@bidets4sale.com' ;

$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 = "feedback@bidets4sale.com" ;

$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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.