Forum Moderators: coopster
You can access session information from within in class/method/function/name space by directly calling it because it is global and available in all spaces.
However, to access your content, you must declare session_start() near the beginning of your code (before you try to access or use sessions). If you do not declare this PHP function, sessions will not be available.
So suppose you stored some data in your session (key of 'name' and value of 'John Smith' and you wanted to update key 'loggedin' with the value of 'true')...
<?php
$name = $_SESSION['name'];
$_SESSION['loggedin'] = true;
?> <?php
session_start();
$name = $_SESSION['name'];
$_SESSION['loggedin'] = true;
?> Remember, to work with sessions in PHP you must open/start them.
If you are doing as above and are still having problems, it may indicate deeper issues (errors in code, logic, etc).