Home »
Imported messages »
comp.lang.php »
simple session question
simple session question [message #175694] |
Fri, 21 October 2011 17:49 |
cerr
Messages: 33 Registered: September 2010
Karma:
|
Member |
|
|
Hi There,
I'm a session newbie and got a (probably) simple question:
I have belowcode and i would expect stp to count up from 1 to 3 then
back to 1 when ever I reload this page but it for some reason always
stays at 0. Why that?
Thank you for assistance!
My code:
if(!isset($_SESSION['stp'])) {
session_start();
$_SESSION['stp'] = 0;
echo "session started<br>\n";
}
switch($_SESSION['stp']) {
case 0: $_SESSION['stp'] = $_SESSION['stp']++;
echo "stp:".$_SESSION['stp'];
break;
case 1: $_SESSION['stp'] = $_SESSION['stp']++;
echo "stp:".$_SESSION['stp'];
break;
case 2: $_SESSION['stp'] = $_SESSION['stp']++;
echo "stp:".$_SESSION['stp'];
$_SESSION['stp'] = 0;
break;
|
|
|
Goto Forum:
Current Time: Sun Nov 10 16:32:09 GMT 2024
Total time taken to generate the page: 0.05140 seconds