For John w/ Q about $_SESSION

From: Date: Thu, 04 Apr 2002 18:27:35 +0000
Subject: For John w/ Q about $_SESSION
Groups: php.windows 
Request: Send a blank email to php-windows+get-12935@lists.php.net to get a copy of this message
Sorry to use public forum I totally lost your email address, but anyways, I finally managed to make this $_SESSION work although it's still weird to me (newbie) because the manual still said session_register() is not needed, but I couldn't find any other way to do it. Enough said, here's my test file (as is), just take a look at it and see if you can run it on your machine: ---- File 1 ---- <? session_start(); //if (!isset($_SESSION['foo'])) { //$_SESSION['foo'] = "test foo"; session_register("foo"); $foo = "Another test"; //} session_register("groo"); $groo = "Test 2"; ?><html><head><title>Reg Ses</title></head> <body bgcolor="#FFFFFF"> <? // echo $_SESSION['foo'] . "<br>"; echo session_id() . "<br>"; echo $groo . "<br>"; echo "<br><br>"; ?> <a href="reg_2.php">reg_2.php</a> </body> </html> ---- File 2 ---- <? session_start(); ?><html><head><title>Sess</title> </head> <body bgcolor="#FFFFFF"> <? print $_SESSION["foo"]." \$_SESSION <br>"; print $_SESSION["groo"] ." \$_SESSION<br>"; print "foo: $foo <br>"; print "groo: $groo <br>"; if (!isset($_SESSION["foo"])) { print "foo is registered!"; } else { print "foo is not registered!"; } echo "<br><br>"; if (session_is_registered("groo")) { print "groo is registered!"; } else { print "groo is not registered!"; } ?> </body> </html>

« previous php.windows (#12935) next »