Re: Session data getting lost
| From: | Curt Zirzow | Date: | Wed, 17 Sep 2003 20:45:18 +0000 |
| Subject: | Re: Session data getting lost | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-162919@lists.php.net to get a copy of this message | ||
* Thus wrote Rich Gray (rich@f1central.net):
> So your telling me that all variables defined in the global scope are
> automatically added to the $_SESSION array...?
> Not true I think....
>
no. read the documentation, in full.
The soluction to your problem was resolved from the first reply (by
Chris Shiflett), but you rejected it because of it not making sense
to you, which seems to be the problem.
> > [snip]
> > Well a functon that doesn't work under certain conditions should be
> > deprecated IMO ... I haven't used it for a long time now...
> >
> > To answer your question ... yep I've used print_r() and after the 1st
> > form
> > submission the entry is set to -1 however at no time do I ever set
> > $_SESSION['test'] to -1 in my code example ...
> > [/snip]
> >
> > Nope, but $test is a GLOBAL variable, and therefore would be set to -1
> > within $_SESSION as all GLOBALS are, as you pointed out earlier,
> > registerd with $_SESSION. If $test is within a function it is a PRIVATE
> > variable, local to the function only, unless declared as a GLOBAL.
> >
Curt
--
"I used to think I was indecisive, but now I'm not so sure."