Re: Re: change value of session variable?
| From: | Chris Shiflett | Date: | Thu, 22 Jul 2004 03:09:44 +0000 |
| Subject: | Re: Re: change value of session variable? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-191465@lists.php.net to get a copy of this message | ||
--- Five <primeooze@hotmail.com> wrote:
> My problem isn't the logic of when and where to output variable
> values. It's figuring out when a session variable will accept
> initialization and what enables and/or prevents it from doing so.
There's no magic. Session variables behave exactly like any other
variable. If you output a session variable before initializing it, you
will see nothing (and a notice is generated, depending on your
error_reporting setting).
The only difference, in terms of using session variables, is that they
persist from page to page.
> I would like to be able to initialize a session variable on one page,
> call a second page, have the code on the second page process some
> information and reinitialize the session variable to another value so
> that new value could be available to be used on the first page.
This is exactly what happens, although when you assign a variable a new
value, I wouldn't call it initializing, since the variable already exists.
Hope that helps.
Chris
=====
Chris Shiflett - http://shiflett.org/
PHP Security - O'Reilly
Coming Fall 2004
HTTP Developer's Handbook - Sams
http://httphandbook.org/
PHP Community Site
http://phpcommunity.org/