RE: [PHP] $_SESSION
| From: | John W. Holmes | Date: | Wed, 13 Nov 2002 04:40:06 +0000 |
| Subject: | RE: [PHP] $_SESSION | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-124146@lists.php.net to get a copy of this message | ||
> I have some code that looks like this:
>
> if(!session_is_registered('errors'))
> session_register('errors');
>
> but i want to do this using the $_SESSION, i tried
> doing it this way
>
> if(!isset($_SESSION['errors']))
> session_register('errors');
>
> but when i echo(isset($_SESSION['errors'])) it prints
> false
>
> So i am not sure how to register a variable with
> $_SESSION
You don't need to use session_register() when you're using $_SESSION.
Just treat $_SESSION as any other variable and assign values to it. To
remove values from it, use unset().
if(!isset($_SESSION['errors']))
{ $_SESSION['errors'] = 'default'; }
---John Holmes...