Jump to content

simple question - after SUBMIT - how do I direct the 'next page?


greggustin

Recommended Posts

guess I am having trouble with the "LOCATION" command?

ie

after I have the user hit submit - it dumps to the 'mail.php page

(which is very simple - ie not a full html page)

do I have to make the mail.php into a full stylized html?

hope not

thought I could do a redirect back to the origination page in the website

I commented out the location command as it was not working

idea?

<?php

$Name=$_POST['Name'];

$email=$_POST['email'];

$comments=$_POST['comments'];

$to="[email protected]";

$message="

From: $Name\n

E-Mail: $email\n

comments: $comments";

$headers = "From: $email\r\n";

$headers .= "BCC: [email protected]\r\n";

 

mail($to,"Comments From $Name", $message, $headers) ;

echo "\n\n\n\n\n\n\n                    . . . . . Thank-you for you Inquiry <br>                    Some one will contact you shorlty";

//header( "Location: /thankyou.html" );

?>

You can't send a location header after you echo content. My suggestion is to get rid of the echo, and put your thank you message on thankyou.html. Then uncomment the header line below, and for good measure but an exit() after the header command. Here is the revised code:

 

<?php
$Name=$_POST['Name'];
$email=$_POST['email'];
$comments=$_POST['comments'];
$to="[email protected]";
$message="From: $Name\nE-Mail: $email\nComments: $comments";
$headers = "From: $email\r\n";
$headers .= "BCC: [email protected]\r\n";

mail($to,"Comments From $Name", $message, $headers)
  or die("Could not send email");
header("Location: /thankyou.html");
exit;
?>

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.