you have to have the variable you register (in both ways) global.
so no matter how you call the function the variable must be defined global.
<?
session_Start();
$foo = "bar";
session_register("foo");
function bob($user){
Global $user, $username, $username2;
# In this way they can "escape the prison of function"
$username = $user . "one";
$username2 = $user . "two";
session_register("username");
session_register("username2");
return true;
}
Sincerely,
Maxim Maletsky
Founder, Chief Developer
PHPBeginner.com (Where PHP Begins)
[EMAIL PROTECTED]
www.phpbeginner.com
-----Original Message-----
From: Jon Rosenberg [mailto:[EMAIL PROTECTED]]
Sent: Sunday, February 25, 2001 1:16 AM
To: PHP List
Subject: [PHP] session_register in function
The variable I register before the function becomes available in the session
to other pages...the variable I register inside the function are not
accessible in the session to ohter pages. Is this normal? How can I work
around this? Thanks! PHP4.0.4pl1 on Linux.
sample code:
<?
session_Start();
$foo = "bar";
session_register("foo");
function bob($user){
$username = $user . "one";
$username2 = $user . "two";
session_register("username");
session_register("username2");
return true;
}
?>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]