Hi all,
I can't get my other pages to read session variables set on one page.
I'm using PHP Version 4.0.4. I have tried $HTTP_SESSION_VARS but found $_SESSION to work as well with this version.
Here's the code for page1.php:
<?php
session_start();
$_SESSION['uid']=24;
echo $_SESSION['uid'];
?>
and for page2.php:
<?php
session_start();
echo $_SESSION['uid'];
?>
On page1.php it echos the value of the Session variable, but on any other page it does not. I know I'm missing something, my code seems just too easy.
Any help is appreciated!
Thanks
Very newbie question about session variables
Moderator: General Moderators
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
$_SESSION isn't working as it would in v4.1 up - you are simply creating an array called $_SESSION which is not special in any way. You need to use $HTTP_SESSION_VARS instead. Also look at the session_register() function.
Mac
Mac