Re: Session variables not working
| From: | Andrew Wood | Date: | Sat, 15 May 2004 16:44:26 +0000 |
| Subject: | Re: Session variables not working | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-186327@lists.php.net to get a copy of this message | ||
If a page accesses the session variables does it need to explicity reset them as well because it would appear that an intermediate PHP script which also reads the 2 variables is destroying the session for no apparent reason
On 14 May 2004, at 22:11, Brad Pauly wrote:
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