RE: [PHP-WIN] newbie cookie question
| From: | patrik dot lindstrom at spectronic dot se | Date: | Tue, 05 Dec 2000 08:06:41 +0000 |
| Subject: | RE: [PHP-WIN] newbie cookie question | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-4291@lists.php.net to get a copy of this message | ||
Hi Larry!
I had the same problem you have, but finally I found my problem:
I used the $HTTP_COOKIE_VARS[cookiename] in a function, but to get that to work
you must declare the variable as global, so I copied a function from a tutorial:
function ReadCookie($name)
{
global $HTTP_COOKIE_VARS;
return $HTTP_COOKIE_VARS[$name];
}
function myfunction()
{
$cookie_user = ReadCookie("cookie_user");
#cookie read, continue
}
NOTE: it should be ok to declare the $cookie_name as global in the function like
this:
function myfunction()
{
global $cookie_user;
#cookie read, continue
}
I didn't try it but it should work.
*****************************************************
Patrik Lindström
Spectronic Research AB
Tel: +46 42 25 20 00
Fax: +46 42 15 68 32
Internet Address: patrik.lindstrom@spectronic.se
Home Page: http://www.spectronic.se
*****************************************************