php - Trouble with session variables
I'm trying to set a session variable and use it on another page.
I have: pg1
session_start(); $_session['sessionID'] = $row['ID'];
Then on page two I have.
session_start(); $userID = $sessionID;
But when I use JC to alert this out I get nothing. Am I doing this wrong?
You need to specify the
$_SESSIONthere because that is the array you stored the value in :)
Have a look at this session tutorial if you want.
On the second page, you'll need to say
You need to do the following on page 2:
You also need to use $_SESSION, not $_session