On Friday, April 12, 2002, at 07:01 PM, Norman Zhang wrote:
> If I have register_globals=off, how do I pass session variables? I tried
> session_register("var1"). session_is_registered("var1") appears
> successful,
> but if I tried to echo the $var1". Nothing shows. How do I pass session
> variables?
Note that you do not need to use session_register() if you are using
PHP4.1.x or greater, in fact you should not use session_register()
IIRC. The new way to create or load a session variables is like so:
<?php
$_SESSION['foo'] = 'bar';
?>
It's that simple. Note that you don't need to use a string constant
('bar'), you could use another variable to make $_SESSION['foo'] refer
to the same thing, as in:
<?php
$baz = 'bar';
$_SESSION['foo'] = $baz;
?>
You can access this new session variable in the way you might expect, by
using $_SESSION['foo'].
Erik
----
Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php