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="greg@BlahBlah.com";

$message="

From: $Name\n

E-Mail: $email\n

comments: $comments";

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

$headers .= "BCC: gustin@BlahBlah.com\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" );

?>

Link to comment
Share on other sites

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="greg@BlahBlah.com";
$message="From: $Name\nE-Mail: $email\nComments: $comments";
$headers = "From: $email\r\n";
$headers .= "BCC: gustin@BlahBlah.com\r\n";

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

Link to comment
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.