Re: Session variables not working

From: Date: Fri, 14 May 2004 21:11:30 +0000
Subject: Re: Session variables not working
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-186260@lists.php.net to get a copy of this message
On Fri, 2004-05-14 at 14:48, Andrew Wood wrote: > I'm trying to set the following two vars on one page then read their > values on another like this: > > page1.php... > > ob_start(); > session_start(); > $_SESSION['member_id'] = $member_id; > $_SESSION['password'] = $password; > ob_end_flush(); Where are $member_id and $password coming from? > page2.php... > > ob_start(); > session_start(); > $member_id = $_SESSION['member_id']; > $password $_SESSION['password']; > ob_end_flush(); I think you want $password = $_SESSION['password']; > But on page2.php the variables are null. Can anyone help me out with > this. I must be doing something really obvious wrong. Where are you outputting the variables to see what they are? You might want to add a print_r($_SESSION) to see what is there. The ob_* functions don't cause any output of variables, they only output what you output within them (if that makes sense). For example: ob_start(); echo 'Hi'; ob_end_flush(); - Brad

« previous php.general (#186260) next »