Jump to content

Checking a Variable on Equality with an Isset Condition Check Wrapped Around


Glese

Recommended Posts

I have the following if statement:

 

if ((isset($select_category) == 'All') || (!isset($select_category)) && (!isset($most_liked))) {

 

 

The value for the variable gets taken from a drop down menu, which is a list of categories.

 

The problem I am having is with the isset condition check is that the variable is always set, but it does not consider the check for equality with the 'All' condition. Which basically means no matter which category I choose from the drop down menu, it always goes to this very first if statement, and does NOT go to the other elseif statement, and I think it has to do with the isset condition check, because without it it would work, though without it I am getting a notice warning, that the variables are undefined.

 

Any ideas how I can make it check if its equal to 'All' together with the isset condition check?

 

What I am trying to say is no matter which category is chosen, with the isset condition check, the variable is always set, thus the if statement is true, there basically seems to be a contradiction going on.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.