makamo66 Posted October 17, 2019 Report 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) { }
administrator Posted October 18, 2019 Report Posted October 18, 2019 Hi, It looks like a problem with your conditional logic. Try reworking your if()
makamo66 Posted October 18, 2019 Author Report 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.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now