Thanks that works in my testing example. But why? The manual says:

Caution
If you are using $_SESSION (or $HTTP_SESSION_VARS), do not use
session_register(), session_is_registered() and session_unregister().

But in index2.php I am using $HTTP_SESSION_VARS and it works?!

Need a bit of clarification since my actual app still doesn't work!

Henry

"Kirk Johnson" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> In the first file, replace this line:
>
> $HTTP_SESSION_VARS['variable']="the variables value";
>
> with these two lines:
>
> $variable = "the variables value";
> session_register('variable');
>
> This is because 'register_globals' is enabled in the php.ini file.
>
> Kirk
>
> > -----Original Message-----
> > From: Henry Grech-Cini [mailto:[EMAIL PROTECTED]
> > Sent: Monday, March 03, 2003 9:34 AM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP] Session variable under PHP 4.0.6
> >
> >
> > Hi All,
> >
> > I'm having a problem with session variables under PHP 4.0.6
> > on a secure
> > server. I ran phpinfo and have attached the resulting page
> > after the main
> > body of this message.
> >
> > My test code looks like this
> >
> > Filename: index.php
> >
> > Page Start --------------
> >
> > <?php
> > session_start();
> >
> > $HTTP_SESSION_VARS['variable']="the variables value";
> >
> > ?>
> > <a href="index2.php">click here</a> to go to the next page
> >
> > Page End ------
> >
> >
> > Next file
> > Filename: index2.php
> >
> > Page Start --------------
> >
> > <?php
> > session_start();
> >
> > print_r($HTTP_SESSION_VARS);
> >
> > echo "--&gt;".$HTTP_SESSION_VARS['variable']."&lt;--";
> > ?>
> >
> > Page End ------
> >
> >
> > Suffice to say it doesn't work. The first page displays
> >
> > "click here to go to the next page"
> >
> >
> > as expected. However clicking on the link takes you to
> > index2.php and the
> > following is displayed:
> >
> >
> > "Array ( ) --><--"
> >
> >
> > Namely that the session variable called "variable" is not set in the
> > session.
> >
> >
> > I have run the exact same code on a machine running PHP 4.2.3
> > (non secure
> > servers) and it works perfectly! And outputs:
> >
> > "Array ( [variable] => the variables value ) -->the variables
> > value<--"



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to