makamo66 Posted October 17, 2019 Report Share Posted October 17, 2019 When I use the following code, it doesn't print out "else if test" until after I refresh the page. unset($_SESSION["product"]); if ( !empty($_SESSION["product"]) && ($_SESSION["product"] != NULL)) { echo "if test"; } else if { echo "else if test"; } When I use: var_dump($_SESSION["product"]); It shows: array(0) { } Quote Link to comment Share on other sites More sharing options...
administrator Posted October 18, 2019 Report Share Posted October 18, 2019 Hi, It looks like a problem with your conditional logic. Try reworking your if() Quote Link to comment Share on other sites More sharing options...
makamo66 Posted October 18, 2019 Author Report Share Posted October 18, 2019 The code didn't actually make the call to unset the variables until after the not empty conditional was asked. I was misled because var_dump still printed out an empty session array. Once I changed the order of my code, it worked. 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.
Note: Your post will require moderator approval before it will be visible.