RE: [PHP] header and session?

From: Date: Tue, 26 Mar 2002 15:40:52 +0000
Subject: RE: [PHP] header and session?
Groups: php.general 
Request: Send a blank email to php-general+get-90200@lists.php.net to get a copy of this message
With register_globals on, $a and $b need to be registered using session_register(). Don't assign them to $_SESSION, PHP does that for you with register_globals on. 1.php ----- session_start(); $a = 'some_value'; $b = 'nuther_value'; session_register('a','b'); header("location: 2.php"); 2.php ----- session_start(); echo "a is $a"; echo "b is $b"; > -----Original Message----- > From: bob [mailto:lly200146@sohu.com] > Sent: Monday, March 25, 2002 8:52 PM > To: php-general@lists.php.net > Subject: Re: [PHP] header and session? > > > On Mon, 25 Mar 2002 08:54:27 -0700, kjohnson@zootweb.com (Johny? ?rk) > wrote: > > >Do you have register_globals turned on or off in php.ini? > What values are $a > >and $b being set to? > > > >Kirk > > > >> -----Original Message----- > >> From: bob [mailto:lly200146@sohu.com] > >> Sent: Sunday, March 24, 2002 4:21 PM > >> To: php-general@lists.php.net > >> Subject: [PHP] header and session? > >> > >> > >> 1.php? 2.php > >> session_start(); session_start(); > >> .......... > .......... > >> $_SESSION['a'] =$a; echo $_SESSION['a']; > >> $_SESSION['b'] =$b; echo $_SESSION['b']; > >> header("location: 2.php"); > >> > >> after jump to 2.php ,there is an warning: undefined index a ,b > >> > >> > >> if i change 1.php to > >> > >> session_start(); > >> .......... > >> $_SESSION['a'] =$a; > >> $_SESSION['b'] =$b; > >> <a href='2.php' >go on </a> > >> > >> it works well! > register_globals is on.$a,$b is set to $_SESSION array,which is > global in any scope. > the problem is i submit a login form to 1.php,which register some > session variable.then,in 2.php,i fail to print them out. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.general (#90200) next »