Page 1 of 1

Redirect Code

Posted: Fri Jul 11, 2008 10:31 am
by dajawu
I need a little help redirecting to another page after a script has already ran. I have a login page that holds the form and the PHP script to authenticate the user as well. After it all runs it displays a message saying you are logged on. How can I redirect the user to another page after all the form and script has already ran without getting an error?

Re: Redirect Code

Posted: Fri Jul 11, 2008 11:10 am
by Reviresco
User header("Location: your_page.php") but you have to make sure it is before any output is sent by the page -- that includes line breaks and spaces. So whatever is you're checking or authenticating, check it first before the script does anything that might send output. Generally this means putting the authentication at the very top of the page.