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

-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to