> -----Original Message-----
> From: OrangeHairedBoy [mailto:[EMAIL PROTECTED]]
> Sent: 16 November 2002 07:23
> To: [EMAIL PROTECTED]
> Subject: [PHP] Re: session handling
> 
> 
> Here's what you need:
> 
> on page 1.php:
> 
> <?php
> session_start();
> $temp = 'someValue';
> session_register("temp");
> ?>
> 
> on page 2.php:
> 
> <?php
> session_start();
> print $temp; /* PHP sets the variables back the way they were 
> for you! */
> ?>
> 
> You have to register the variable with the session first so 
> it knows that
> it's a variable that needs monitored and, when the script 
> finishes, needs
> saved.

Actually, Anjali is right on this one, so long as (s)he's using a PHP version that 
defines the $_SESSION array; in this case, it's actually recommended to use only the 
$_SESSION array, and not use session_register at all.

That said, I can't see anything wrong with the original scripts posted, so the obvious 
questions are:

(1) are you sure you're using a recent version that supports the $_* superglobals 
arrays?

(2) If so, please show how you're reaching 2.php from 1.php.

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211 

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

Reply via email to