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 ? Link to comment https://forums.phpfreaks.com/topic/41542-cookie-blues-pleasssssssse-help/ Share on other sites More sharing options...
redarrow Posted March 7, 2007 Share Posted March 7, 2007 if ($_Cookie['imagestatus']==1) Link to comment https://forums.phpfreaks.com/topic/41542-cookie-blues-pleasssssssse-help/#findComment-201311 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. Link to comment https://forums.phpfreaks.com/topic/41542-cookie-blues-pleasssssssse-help/#findComment-201314 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. Link to comment https://forums.phpfreaks.com/topic/41542-cookie-blues-pleasssssssse-help/#findComment-201319 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. Link to comment https://forums.phpfreaks.com/topic/41542-cookie-blues-pleasssssssse-help/#findComment-201322 Share on other sites More sharing options...
jini01 Posted March 7, 2007 Share Posted March 7, 2007 .. Link to comment https://forums.phpfreaks.com/topic/41542-cookie-blues-pleasssssssse-help/#findComment-201388 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); Link to comment https://forums.phpfreaks.com/topic/41542-cookie-blues-pleasssssssse-help/#findComment-201392 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.