>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:[EMAIL PROTECTED] 
Sent: Wednesday, February 26, 2003 1:16 AM
To: [EMAIL PROTECTED]
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
[EMAIL PROTECTED]

zzzzz


-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to