Storing variables $GLOBALS vs. $_SESSION


#1

Hello,
I need to store several variables in login.php for use in index.php. I tried:

$_SESSION[‘logged_in’] = true;

but when index.php tries to access this variable

$status = $_SESSION[‘logged_in’];

its not set.

Help please.


#2

At the top of every page that you are using session variables you must have session_start(); before you use the session variables.


#3

Thanks, it works!
Cant believe PHP is so powerful. Just started using it a few days ago.
Thanks again,
-Charles