I have stored a session using the following in one of my .php file:
session_start();
$_SESSION['uid'] = $_POST['uid'];
When I navigate to some other .php file and tried to access the value by doing:
$_SESSION['uid']
I got an error:
Notice: Undefined variable: _SESSION in C:\wamp\www\saved.php on line 6
line 6 is:
$result->execute(array($_SESSION['uid']));
Why is this?
You need to make sure you call
session_start()on every page on which you want to access session vars.