PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I've simplified the following code just to get an understanding why the code is executed this way. This code will redirect to pagetwo.php instead of executing the if statement and redirecting to pageone.php. Why is this? I know it's easy to have pagetwo.php in an else statement and all will be fine but I'm curious why it wouldn't work this way also.
Have you taken a look at the headers that get output by that script? You can use the php socket functions to debug this kind of stuff. Most likely your script is outputting both Location: headers, the latter of which is being applied.
hmm, so if you don't put an exit(); after the redirect inside the if statement the code will continue to execute and send both headers, with the last one, pagetwo.php, being the page that is loaded since it was last.