Page 1 of 1

$HTTP_COOKIE_VARS question

Posted: Thu Jun 16, 2005 9:10 am
by surfinglight
Hi,

I have a line of code in my program as follows:
$username = $HTTP_COOKIE_VARS["myusername"];

From time to time, it fails to return a value.

Can anyone tell me how I can avoid this?

I tried to change the code as follows but still the same:
$username = $_COOKIE["myusername"];

Your help will be greatly appreciated.

Posted: Thu Jun 16, 2005 10:25 am
by anjanesh
Are you storing the cookie using setcookie() function ?

RE: Are you storing cookies...

Posted: Thu Jun 16, 2005 5:19 pm
by surfinglight
Yes.

I am storing it as follows:
setcookie ("username", $username,time()+999999);