Copy link to clipboard
Copied
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, s
...Copy link to clipboard
Copied
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.