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.
I need beginner's code help
Moderator: General Moderators
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
Ok, i tried that
I added the session_start(); to the second page, but it is still not recognizing that $_SESSION['logged_in'] has been created and it still just redirects back to the first page. Any more suggestions would be appreciated.