Forum Moderators: coopster
<?php
session_start();
if (session_is_registered("gx_user"))
{
echo "Welcome,".$gx_user."<br />"; // RESULT A
}
else
{
// blah blah stuff RESULT B
}
?>
Like i said when the information is first entered it displays fine, but once it is refreshed it will still give result A, as desired, expect it just doesn't keep the var. I turn on error_reporting(E_ALL); and it says:
Notice: Undefined variable: gx_user in /home/.hostname/blah_user_blah/www.example.com/index.php on line 131
thanks a lot
-Mike
<?php
session_start();
if (isset($_SESSION["gx_user"]))
{
echo "Welcome,".$_SESSION["gx_user"]."<br />"; // RESULT A
} else {
echo 'blah blah stuff RESULT B';
}
?>
I've used the exact same code, actually have it running on another website and it works fine, but I tried it here on a new server and I've been having to modify different things to make it work.
-FM-
There is a defect in PHP 4.2.3 and earlier. If you register a new session variable by using session_register(), the entry in the global scope and the $_SESSION entry will not reference the same value until the next session_start(). I.e. a modification to the newly registered global variable will not be reflected by the $_SESSION entry. This has been corrected in PHP 4.3.0.
[php.net...]
:)