jeff5656 Posted April 5, 2009 Share Posted April 5, 2009 When someone logs in with the correct password, it is stored in a cookie called zzzcookie. On another page, I want to do something based on whether that cookie exists. When I try this, it doesn't work: if (isset($_COOKIE[$zzzcookie])) { header("Location: xray_displaypotential.php"); } else { header("Location: xray_newpatient.php"); } The else statement is executed even if the zzzcookie exists. Quote Link to comment https://forums.phpfreaks.com/topic/152661-solved-if-else-based-on-whether-a-cookie-exists/ Share on other sites More sharing options...
wildteen88 Posted April 5, 2009 Share Posted April 5, 2009 if zzzcookie is the name of your cookie then it should be $_COOKIE['zzzcookie'] not $_COOKIE[$zzzcookie] Quote Link to comment https://forums.phpfreaks.com/topic/152661-solved-if-else-based-on-whether-a-cookie-exists/#findComment-801716 Share on other sites More sharing options...
jeff5656 Posted April 5, 2009 Author Share Posted April 5, 2009 Thanks that did it! Quote Link to comment https://forums.phpfreaks.com/topic/152661-solved-if-else-based-on-whether-a-cookie-exists/#findComment-801721 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.