Guest upirate Posted March 7, 2007 Share Posted March 7, 2007 Im setting a cookie like this: setcookie("imagestatus", "1", time()+ (86400 * 30));//30 days But my if statement is not evaluating as true if ($_Cookie['imagestatus']=="1") any suggestions ? Quote Link to comment Share on other sites More sharing options...
redarrow Posted March 7, 2007 Share Posted March 7, 2007 if ($_Cookie['imagestatus']==1) Quote Link to comment Share on other sites More sharing options...
Guest upirate Posted March 7, 2007 Share Posted March 7, 2007 same thing. :-( print_r gives me a 1 But for some reason that statement is not evaluating as true. Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted March 7, 2007 Share Posted March 7, 2007 are you trying to check on the same script run? if so it won't work. Once a cookie has been set it is NOT available to use until the current script has finished running... I should however be available on the next page run. Quote Link to comment Share on other sites More sharing options...
Guest upirate Posted March 7, 2007 Share Posted March 7, 2007 ok this is what i found out print_r gives me a 1 also I cannot do echo $_Cookie['imagestatus']; as it doesnt print anything. No matter how many times I run the script..same thing happens. print_R gives returns a 1. Quote Link to comment Share on other sites More sharing options...
jini01 Posted March 7, 2007 Share Posted March 7, 2007 .. Quote Link to comment Share on other sites More sharing options...
interpim Posted March 7, 2007 Share Posted March 7, 2007 assign the cookie to a variable and use the variable... $var1=$_COOKIE['cookie_var']; (code with $var1 in it); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.