I need beginner's code help
Posted: Mon Dec 08, 2003 5:23 am
OK, I seem to be having a problem where my session variables are not registering properly. They seem to exist only for the existance of the page they are referenced on and that is it.
My code for page 1 and 2 follow respectively.
PAGE1
<?php
session_start();
$_SESSION['logged_in'] = "False";
?>
PAGE2
<?php
if (!isset($_SESSION['logged_in'])) {
header("Location: http://returntopage1");
/* Redirect browser */
/* Make sure code below does not execute when we redirect. */
exit;
}
?>
The page 2 is never displayed, it always goes back to page 1, so therefore I do not believe logged_in variable is ever making it to page 2.
Any help would be greatly appreciated.
My code for page 1 and 2 follow respectively.
PAGE1
<?php
session_start();
$_SESSION['logged_in'] = "False";
?>
PAGE2
<?php
if (!isset($_SESSION['logged_in'])) {
header("Location: http://returntopage1");
/* Redirect browser */
/* Make sure code below does not execute when we redirect. */
exit;
}
?>
The page 2 is never displayed, it always goes back to page 1, so therefore I do not believe logged_in variable is ever making it to page 2.
Any help would be greatly appreciated.