I'm setting up a simple landing page on DreamHost. It won't let me put php code in the file index.html. So, when user submits an email address, I use $_POST to submit the email address to another page mail_auto.php.
After seeing a quick "email sent" message, I'd like the user to be directed back to the index.html page from mail_auto.php.
header() looks a bit complex and seems to interfere with the execution of the balance of mail_auto.php.
What's the best way to redirect the user?
header()isn't complex at all, use it like thisheader('Location: index.html');header("Location: index.html");is the simplest way to redirect someone on the server side. What problems are you encountering with it?header()at the beginning of the script. So, my concern is the balance of the script won't get executed.header()anywhere in the script. The trick is that you cannot send any content before you callheader(). So you can't do something likeecho "hello world"; header("Location: index.html");