$HTTP_COOKIE_VARS question

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
surfinglight
Forum Newbie
Posts: 9
Joined: Wed May 04, 2005 10:04 pm

$HTTP_COOKIE_VARS question

Post 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.
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post by anjanesh »

Are you storing the cookie using setcookie() function ?
surfinglight
Forum Newbie
Posts: 9
Joined: Wed May 04, 2005 10:04 pm

RE: Are you storing cookies...

Post by surfinglight »

Yes.

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