Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

php cookies not working??!!

Status
Not open for further replies.

aarrgghh

Technical User
Sep 5, 2002
60
US
Hey all,
I am having a problem with the cookies being available after they have been set. First, I set the cookie. Then I proced to another page and try to get the value of the cookie and I cant. Can you see any problems here that I may have?

$firstName = $_POST['firstName'];
$set = setcookie('Fisrt', $firstName);

if (!$set)
{echo "Cannot set cookie.";}
else { echo &quot;Set the cookie.<br>&quot;;}

This returns true (i.e., &quot;Set the cookie.&quot;).

Then I go to the next page and try to access the cookie.

if (!$HTTP_COOKIE_VARS['First'])
{echo &quot;Cannot see the cookie.&quot;;}
else {echo $HTTP_COOKIE_VARS['First'];}

I get Cannot see the cookie.

ANy ideas? Thanks.
 
Holy Cr@p!! Do you kow how long I have been staring at that thing??!! Son of a .... Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top