RE: [PHP] Very simple session question
| From: | Chetan Rane | Date: | Tue, 27 May 2008 04:33:32 +0000 |
| Subject: | RE: [PHP] Very simple session question | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-274714@lists.php.net to get a copy of this message | ||
Hi
Please check if your cookies are disabled on your browser if they are
disabled then the Session wont work.
Chetan Dattaram Rane
Software Engineer
-----Original Message-----
From: tedd [mailto:tedd.sperling@gmail.com]
Sent: Tuesday, May 27, 2008 7:19 AM
To: php-general@lists.php.net
Subject: Re: [PHP] Very simple session question
At 10:16 PM +0100 5/26/08, John Allsopp wrote:
>Hi
>
>I've gone bozzeyed, so I've a simple question for you.
>
>I open session_start() as the first thing, on each page.
>
>I set a session variable using, for instance,
>$_SESSION['ACCOUNTemail'] = $email;
>
>The next program, when I var_dump($_SESSION), it shows an empty array.
>
>That program does run session_start() too.
>
>What's obviously wrong, or what's my most likely cause?
>
>Cheers
>J
J:
That should work. Are you sure you're using
<?php session_start();
I forgot the () one time and it had me going for a while.
Also, try this (it should work):
======= Page 1
<?php session_start(); // page1.php
$num = isset($_SESSION ['num']) ? $_SESSION ['num'] : 0;
$num = 1;
$_SESSION ['num'] = $num;
echo($num);
?>
<form action="page1.php">
<input type="submit" value="Goto the next page">
</form>
======= Page 2
<?php session_start(); // page2.php
$num = isset($_SESSION ['num']) ? $_SESSION ['num'] : 0;
echo($num);
?>
<form action="page1.php">
<input type="submit" value="Goto the last page">
</form>
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php