jonniejoejonson Posted January 22, 2008 Share Posted January 22, 2008 I am trying to read a session variable that is set on page1.php from page2.php page1.php>>>>>> <? session_start(); $_SESSION['views'] = 1; ?> <a href="page2.php">link to page2</a> page2.php>>>>>>> <? echo $_SESSION['views']; ?> why does this not work... thanks alot to any responders. J Quote Link to comment https://forums.phpfreaks.com/topic/87138-sessions-being-read-ffrom-differnet-pages/ Share on other sites More sharing options...
teng84 Posted January 22, 2008 Share Posted January 22, 2008 you have to have session start on each pages! Quote Link to comment https://forums.phpfreaks.com/topic/87138-sessions-being-read-ffrom-differnet-pages/#findComment-445679 Share on other sites More sharing options...
Nhoj Posted January 22, 2008 Share Posted January 22, 2008 As teng84 outlined... Page 2 should also have session_start(); at the top: <? session_start(); echo $_SESSION['views']; ?> Quote Link to comment https://forums.phpfreaks.com/topic/87138-sessions-being-read-ffrom-differnet-pages/#findComment-445682 Share on other sites More sharing options...
jonniejoejonson Posted January 22, 2008 Author Share Posted January 22, 2008 I don't know whether you are familiar with the term.. 'derrrrr brain.' it basically means thicko... and it aplies to me... thanks alot for your responses.... J. Quote Link to comment https://forums.phpfreaks.com/topic/87138-sessions-being-read-ffrom-differnet-pages/#findComment-445685 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.