Very newbie question about session variables
Posted: Thu Jul 04, 2002 9:26 am
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
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