>I got a problem with refreshing session variables. >When the following code is run , for the first time >both $z and $secretstring are showing same values. > >But when page is refreshed, the $secretstring variable >is still having the old value no matter how many times >I click refresh. > >Am I missing some thing ?
I always put the session_register stuff *before* I start putting stuff into my variables, but maybe that's just me... What you are missing, though is that whether you 'unregister' it or not, you *always* 'register' it again in the next line. If you expect it to change, you'd need: else{ session_regsiter('secretstring'); } ><? >$x = mt_rand (1000,10000); >$y = mt_rand (1000,10000); > >$text = $x.$y; >$secretstring =$x.$y; > >session_start(); >if(session_is_registered("secretstring")){ >session_unregister("secretstring"); >} >session_register("secretstring"); > >echo "<BR>".$text; >echo "<BR>".$secretstring; > >?> > -- 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