RE: [PHP] Sessions and switching between php and htm documents

From: Date: Wed, 27 Feb 2002 13:47:11 +0000
Subject: RE: [PHP] Sessions and switching between php and htm documents
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-86408@lists.php.net to get a copy of this message
tested the $HTTP_SESSION_VARS prior to sending, set just fine. changed the next page to php and tested for the session var... nothing. [in login.php] <? session_start(); # database check in here if(match){ $HTTP_SESSION_VARS["UserID_session"]=$txtUserID; #from form field for user $HTTP_SESSION_VARS["UserNum_session"]=$databaseresult; # from database result for user number header("Location: successlogin.php"); # or .htm - changed this to test if var was being passed exit; }else{ header("Location: wrongpassword.htm"); exit; } ?> [in successlogin.php] <? echo $HTTP_SESSION_VARS["SellerID_session"]; ?> if I check session_id() - it is the same in both pages. Variables just aren't getting stored/retrieved. ideas? as an aside, how do you destroy/start a new session with new session id? or do you just destroy the variables then use the same session id for the new session? Dave >Did you test and make sure the variable is set? >login.php > session_start(); > $HTTP_SESSION_VARS["username"]=$formUserName; > echo $HTTP_SESSION_VARS["username"] > header("Location: displaypage.htm"); > >Also, for grins ang giggles, make the middle page in the chain a HP, start >the session and test for the variable. If it does not work then the problem >is not the middle page being html. >Subject: [PHP] Sessions and switching between php and htm documents > > >login.htm > form submits information > >login.php > session_start(); > $HTTP_SESSION_VARS["username"]=$formUserName; > header("Location: displaypage.htm"); > >displaypage.htm > show some static stuff > links to formpage.htm > >formpage.htm > form submits information to form.php > >form.php > session_start(); > echo $HTTP_SESSION_VARS["username"]; <- has no value > >

« previous php.general (#86408) next »