PHP - if go to one page, else go to another?!?
I have an if, else statement and I want to go to one page if and another page else. I can't seem to get it to go the page. It goes nowhere. Can someone give me a sample php code how to do this? Thanks!
I have an if, else statement and I want to go to one page if and another page else. I can't seem to get it to go the page. It goes nowhere. Can someone give me a sample php code how to do this? Thanks!
Rick4209 wrote:
I have an if, else statement and I want to go to one page if and another page else. I can't seem to get it to go the page. It goes nowhere. Can someone give me a sample php code how to do this? Thanks!
if (isset($_SESSION['MM_Username'])) {
header ('Location: http://example.com/loggedin.php');
exit;
} else {
header ('Location: http://example.com/login.php');
exit;
}
I suspect if you're going nowhere, it's because there is output before the call to header. For an explanation, see http://kb2.adobe.com/community/publishing/505/cpsid_50572.html.
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.