Question:
forward to a different page on php form submit?
decentg
2009-07-29 09:32:47 UTC
i am working on my website feed back page and as soon as user submit the send button, it should send me an email at the same time forward the user to a new page.The email portion is working but how can i forward them to the new page.The code looks like this

(sendmail.php sends the email) What code should i use to forward to a different page after the email is sent and where? Plzzz help
Three answers:
flybishop
2009-07-29 09:39:25 UTC
In the sendmail.php page, right before your closing ?> tag put this:



header("Location: index.php");



You can change index.php to whatever page you want to redirect to as long as you don't have any output going to the screen. If you have an echo statement somewhere in sendmail.php then header() will fail because the headers have already been sent.
HeliGuy
2009-07-29 09:40:44 UTC
This will need to go inside the sendmail.php page, after the portion of the script that sends the email.



By php:




header("Location: http://www.blahblah.com");

?>



By html



anonymous
2016-02-27 08:18:39 UTC
the header function works with GET. Why not take all the POST variables and send them on as GET variables? If the number of variables is.... uh... variable... then just send them as a *something*-seperated-values string in GET. like csv or your own favorite delimeter (obviously not ?, =, /, :, or &).


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...