>Hello All, > >I, having problems getting HTTP_SESSION_VARS to work the way I think they >should. >Shouldn't I just be able to do something like: > >in a file called index.php I have the following; > ><?php >session_start(); >?> ><html> ><head></head> ><body> >The session_id is <?php echo "\"".session_id()."\""; ?> > ><a href="index2.php">Next</a> ><?php >$HTTP_SESSION_VARS['count']=123;
Don't stuff things directly into that array. Bad Idea (tm). Use: session_register('count'); $count = 123; >?> ></body> ></html> > >In index2.php I then have ><?php >session_start(); >?> ><html> ><head></head> ><body> >The session_id is <?php echo "\"".session_id()."\""; ?> ><?php >echo "\$HTTP_SESSION_VARS['count']=".$HTTP_SESSION_VARS['count'].".<BR>"; >?> ></body> ></html> > >Now when I go to the first one all is great and the session id is shown. But >when I click on the "Next" link I get the next page with the same session id >shown (all well and good) but no value in $HTTP_SESSION_VARS['count']!!! > >Where am I going wrong? Newer versions of PHP use $_SESSION not $HTTP_SESSION_VARS. In *ANY* case, the documented procedure is to use: session_register('count'); $count = /* whatever you want here */; Stuffing junk into PHP's internal arrays that PHP *happens* to be using this week to force session variables to spring into existence or altering their values directly in that internal array is just *wrong*, no matter how many 'experts' you see doing it. Use the documented session_register() function. http://php.net/session_register -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php