Forum Moderators: coopster
I am having a form with 4 drop down menus. all the drop downs are pre-populated. now i have to query the database depending on the options selected by the user and display the output in a tabular format.
i can do this if i have just 2 drop down boxes but it is getting difficult to handle 4 drop down boxes.
even in the 2 drop downs, when i am trying to use an if else statement, the else part is never executed.
is there any fix format to follow to solve this issue...it would be great if you could make me understand this..
Thanks
Sugam
PHP_Chimp suggested to use switch statement instead of if.else if.
here are my 4 drop down boxes:
1. Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec, All
2. x1,x2,all
3. yes, no
4. yes, no
the conditions i need to chk is:
for drop down box
1. whether its =all or <>all
2. =all or <>all
3. yes or no
4. yes or no
so according to all permutations and combinations, can you help me write a switch statement?
here is my data for the drop downs:
1. Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec,All
2. a,b,all
3. yes,no
4. yes,no
the check conditions for the above drop downs are as follows:
$var1 = all or any(any month from jan to dec)
$var2 = all or any(any of the values a or b)
$var3 = yes or no
$var4 = yes or no
I started off using if-elseif and it is driving me nuts right now.
e.g. if ($var1==all){
if ($var2==all && $var3==no && $var4==no){}
elseif ($var2==all && $var3==yes && $var4==no){}
...
...
..
so basically i want to design a switch statement for above conditions.
Please help!