I cant get PHP sessions to work.
I have a login page with this code:
session_start() ;
$_SESSION['userid'] = $userid;
echo $_SESSION['userid'];
When i access the page and enter my login details it runs through this piece of code and the echo statement prints out the userid as expected.
However when i then click an href to go to another page on my site I have the following code:
session_start() ;
$userid=$_SESSI ON['userid'];
echo $userid;
The echo statement returns nothing. Am i using sessions correctly or is there something more I need to do?
Cheers.
I have a login page with this code:
session_start() ;
$_SESSION['userid'] = $userid;
echo $_SESSION['userid'];
When i access the page and enter my login details it runs through this piece of code and the echo statement prints out the userid as expected.
However when i then click an href to go to another page on my site I have the following code:
session_start() ;
$userid=$_SESSI ON['userid'];
echo $userid;
The echo statement returns nothing. Am i using sessions correctly or is there something more I need to do?
Cheers.
Comment