Re: Very simple session question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux