Retrieving the session variable
Posted: Sat Aug 30, 2003 11:57 am
Hi!
I have been trying to solve my problem on session but no to avail. My problem is that the session that I have set on a page is not visible on another page.
// noname1.php
session_start();
if ( !session_is_registered("userID") )
{
session_register("userID");
$userID = 25;
}
After submitting the page to another page
// noname2.php
session_start();
print("User ID: " . $userID . "<br>");
There's no value on $userID. I have look to many books already and documentation regarding the session and my implementation is the same with them. And I can't think of anything already why it doesn't work on my PC. I was able to setup the apache and php successfully. I have tried this on Windows 2000 and Windows XP home and result is the same.
I hope you guys can give me some points or help that I might have missed.
Thanks a lot in advance.
I have been trying to solve my problem on session but no to avail. My problem is that the session that I have set on a page is not visible on another page.
// noname1.php
session_start();
if ( !session_is_registered("userID") )
{
session_register("userID");
$userID = 25;
}
After submitting the page to another page
// noname2.php
session_start();
print("User ID: " . $userID . "<br>");
There's no value on $userID. I have look to many books already and documentation regarding the session and my implementation is the same with them. And I can't think of anything already why it doesn't work on my PC. I was able to setup the apache and php successfully. I have tried this on Windows 2000 and Windows XP home and result is the same.
I hope you guys can give me some points or help that I might have missed.
Thanks a lot in advance.