Thanks, globalising it has sortd it out.
"John Holmes" <[EMAIL PROTECTED]> wrote in message
000401c21db7$47aee4a0$b402a8c0@mango">news:000401c21db7$47aee4a0$b402a8c0@mango...
> Function whatever()
> {
>   global $testcookie;
>
> or
>
>   global $HTTP_COOKIE_VARS;
>
> or
>
> upgrade your PHP and jus use $_COOKIE['testcookie'] and it's always
> available, regardless of scope.
>
> ---John Holmes...
>
> > -----Original Message-----
> > From: Chris Morrow [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, June 27, 2002 4:30 AM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP] Accessing cookies in required files
> >
> > Hi,
> >
> > Can anyone help with this problem?
> >
> > I have a file called "settings.inc" which I include in all files on my
> > site
> > like this:
> >
> > require("settings.inc");
> >
> > Up until now this has worked fine. But now I have a function in the
> > settings.inc file that tries to read the value of a cookie called
> > "testcookie". My problem is that the settings.inc file doesn't seem to
> be
> > able to access the cookie at all. But if I try to access it direct
> from a
> > page rather than the required file it works fine.
> >
> > Does anybody know why I can't access my cookie in my required file?
> They
> > are
> > all on the same directory level etc.
> >
> > Thanks for any help.
> >
> >
> >
> > --
> > 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

Reply via email to