greggustin Posted February 19, 2008 Share Posted February 19, 2008 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" ); ?> Quote Link to comment Share on other sites More sharing options...
aschk Posted February 19, 2008 Share Posted February 19, 2008 You CAN'T echo before you do a header. So remove your echo statement and it'll redirect as expect. Also an error message would be good but i expect it's saying "header already sent..." Quote Link to comment Share on other sites More sharing options...
rhodesa Posted February 19, 2008 Share Posted February 19, 2008 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; ?> Quote Link to comment Share on other sites More sharing options...
greggustin Posted February 19, 2008 Author Share Posted February 19, 2008 wow 2 great replys so fast thanks will try them now Quote Link to comment Share on other sites More sharing options...
rhodesa Posted February 19, 2008 Share Posted February 19, 2008 yeah, sorry for the double post aschk...it didn't give me the normal warning that someone had posted while I was writing mine Quote Link to comment Share on other sites More sharing options...
greggustin Posted February 19, 2008 Author Share Posted February 19, 2008 well - it worked - thanks now - trying to be a 'good member' here but cannot find the "Topic Solved" link referenced in the stickies?? Quote Link to comment Share on other sites More sharing options...
rhodesa Posted February 19, 2008 Share Posted February 19, 2008 To my knowledge the Topic Solved button is still broken :-\ Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.