Re: Session problem
| From: | Maxim Maletsky | Date: | Mon, 19 May 2003 00:55:07 +0000 |
| Subject: | Re: Session problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-148133@lists.php.net to get a copy of this message | ||
On Sun, 18 May 2003 09:50:59 -0700 (PDT)
Donahue Ben <fun23_us@yahoo.com> wrote:
> i have two php scripts the first one says:
> test.php
> <?php
> session_start();
>
> if(!isset($_SESSION['testsession']))
> $_SESSION['testsession']=0;
>
> //empty session array
> $testsession=array();
>
> $testsession['testthis']='hello';
>
> echo(isset($testsession['testthis'])); //this prints
> true
>
> header("Location: test2.php");
> ?>
>
> test2.php
> <?php
> session_start();
>
> echo(isset($testsession['testthis'])); //this prints
> false
>
> session_unregister('testsession');
> ?>
>
> What I can figure out is in the test.php script the
> echo statement prints out true, in the test2.php
> script the echo statement prints out false. Why does
> it print out false?????
A good idea is to always refer to any session data as
$_SESSION['whatever']. This way, your session arrays will always be intuitive
and passed over all the time as long as you've got session_start() on
top of your pages.
--
Maxim Maletsky
maxim@php.net