With register_globals on:
1. Put session_start() at the top of each page.
2. Initialize the variable, then call session_register():
$foo = 'bar';
session_register('foo');
3. Do all assignments to $foo, not $HTTP_SESSION_VAR['foo'], since $foo gets
written to $HTTP_SESSION_VAR['foo'] at the end of the current page, and so
will overwrite anything that was assigned to $HTTP_SESSION_VAR['foo'].
4. Because of #3, the value assigned to $foo won't be available in
$HTTP_SESSION_VAR['foo'] until the next page.
Clear as mud? I thought so ;)
Kirk
> -----Original Message-----
> From: Brandon [mailto:[EMAIL PROTECTED]]
> Sent: Monday, July 01, 2002 4:02 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] How to use Session Variables
>
>
> Could anybody point me to a good tutorial/howto on how to
> make a variable
> accessible to all of my PHP pages? I'm running PHP 4.0.6 with
> register_globals set to ON... (I cant change that). I've
> tried with the
> $HTTP_SESSION_VAR,$_SESSION, and session_register() method
> but just can't
> seem to make it work. Any help would be appreciated.
>
> Thanks,
> Brandon
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php