RE: [PHP] Session confusion again :( - Thanks!
| From: | Paul Fine | Date: | Wed, 14 Apr 2004 16:52:34 +0000 |
| Subject: | RE: [PHP] Session confusion again :( - Thanks! | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-183353@lists.php.net to get a copy of this message | ||
Thanks guys but I have register globals ON so once the session variable is
defined I should be able to address it without specifying $_SESSION ?
-----Original Message-----
From: Chris W. Parker [mailto:cparker@swatgear.com]
Sent: April 14, 2004 11:48 AM
To: BOOT; php-general@lists.php.net
Subject: RE: [PHP] Session confusion again :( - Thanks!
BOOT <mailto:pfine@of-law.com>
on Wednesday, April 14, 2004 9:40 AM said:
> What I can't understand is why Test1 shows as nothing, while
> Test2 shows the value I wanted. Thanks a lot!
[snip]
> $_SESSION['element_countp'] = count($p_lnames);
> echo "TEST 1".$element_countp;
>
> $element_countp = $_SESSION['element_countp'];
> echo "TEST 2".$element_countp;
because in test 1 $element_countp has not been assigned anything yet.
$_SESSION['element_countp'] and $element_countp are *not* the same
variable (it appears that you think they are).
in test 2 you assign the value of $_SESSION['element_countp'] to
$element_countp so that's why test 2 works.
hth,
chris.