Re: PHP not remembering sessions
| From: | Daniel Guerrier | Date: | Thu, 23 Oct 2003 20:03:44 +0000 |
| Subject: | Re: PHP not remembering sessions | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-167339@lists.php.net to get a copy of this message | ||
Use
$_SESSION['var']
instead of
$_SESSION["var"]
--- "Golawala, Moiz M (IndSys, GE Interlogix)"
<Moiz.Golawala@ge.com> wrote:
> Hi All,
>
> I have a problem with PHP not remembering sessions.
> for example:
>
> in page1.php:
>
> <? session_start();
> $_SESSION["var"] = "Please help"; ?>
> <form action="sessionTest2.php" method=post>
> <input type="text" name="loopCount" size="21",
> maxlength="20"></td>
> <input type="submit" value="Submit"></td>
>
>
> in page2.php
> <? session_start();
> echo $_SESSION["var"];
> echo $_POST["loopCount"];
> ?>
>
> what I see above is only data for loopCount. I am
> not able to see the "Please help" on page2
>
> I noticed that 2 cookies were created one for each
> session start. When I opened one of the cookies, I
> noticed that the data "Please help" was in the
> session cookie. Somehow php thinks a session is not
> already created and starts a new session on
> page2.php.
>
> my php.ini file has:
> register_globals = off
> session.use_cookies = 1
> session.use_only_cookies = 1
> session.auto_start = 0
> session.gc_maxlifetime = 1440
>
> Please can someone help me. I am not sure what I am
> doing wrong? Maybe it is some configuration that is
> causing this issue. Any help appreciated.
>
> Thanks,
> moiz
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com