RE: [PHP-WIN] newbie BASIC sessions...

From: Date: Wed, 26 Feb 2003 07:09:45 +0000
Subject: RE: [PHP-WIN] newbie BASIC sessions...
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-18708@lists.php.net to get a copy of this message
From php.net (): http://www.php.net/manual/en/function.session-is-registered.php Note: If $_SESSION (or $HTTP_SESSION_VARS for PHP 4.0.6 or less) is used, use isset() to check a variable is registered in $_SESSION The code that should work: (You may not need to add SID to your link, depending on your php config) S1.PHP: <?php session_start(); $_SESSION['userid']="joe"; echo ("<A HREF=\"s2.php?".SID."\">s1</A></P>"); ?> S2.PHP: <?php session_start(); if (!isset($_SESSION['userid'])) { echo "userid not set"; } else { echo ($_SESSION['userid']." is the NAME"); } ?> -----Original Message----- From: Leo G. Divingracia III [mailto:ldivinag@csuhayward.edu] Sent: Wednesday, February 26, 2003 1:16 AM To: php-windows@lists.php.net Subject: [PHP-WIN] newbie BASIC sessions... okay, i'm stumped as heck. i cant seem to get it this to work. using win2k, apache 1.3.x, php4.3.0, registers_globals OFF. S1.PHP: <?php session_start(); //$userid = "blow"; //session_register ('userid'); $_session['userid']="joe"; echo (' <A HREF="s2.php">s1</A></P>'); ?> S2.PHP: <?php session_start(); if (!session_is_registered ("userid")) { echo ("not registered"); } else { if (!isset($_session['userid'])) {echo "userid not set";} else { echo ($_session['userid']." is the NAME"); session_unregister ('userid'); } } ?> result is "userid not set" each time. am i missing something so basic here? i've read through the RTFMs, various web sites describing sessions, etc... thanks... -- Leo G. Divinagracia III ldivinag@csuhayward.edu zzzzz -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.windows (#18708) next »