Php code: & lt ;! -- Category selection box -- & gt; & lt; formmethod & quot; get & quot; action & quot; show_by_Price.php & quot; target & quot; showframe & quot; & gt; & lt; selectname & quot; catego php form problems
The php code is as follows:
Price:
Show_by_Price.php:
If ($ _ GET [categories] = 'pleasechoose '){
If ($ _ GET [price] = 'Please _ Choose '){
// $ Result_price = null;
Echo Please_choose;
}
Else {
If ($ _ GET [price] = 'higint '){
Echo p_H;
$ Result_price = mysql_query ("SELECT * FROM Product where Price> 2000 ");
}
Elseif ($ _ GET [price] = 'middle '){
Echo p_M;
$ Result_price = mysql_query ("SELECT * FROM Product where Price <2000 & Price> 1000 ");
}
Else {
Echo p_L;
$ Result_price = mysql_query ("SELECT * FROM Product where Price <1000 ");
}
}
}
Else
{
If ($ _ GET [price] = 'Please _ Choose '){
Echo C_P;
$ Result_price = mysql_query ("SELECT * FROM Product where Category = '$ _ GET [categories]'");
}
Else {
If ($ _ GET [price] = 'higint') {echo C_H;
$ Result_price = mysql_query ("SELECT * FROM Product where Price> 2000 and Category = '$ _ GET [categories]'");
}
Elseif ($ _ GET [price] = 'middle') {echo C_M;
$ Result_price = mysql_query ("SELECT * FROM Product where (Price <2000 & Price> 1000) and Category = '$ _ GET [categories]'");
}
Else {echo C_L;
$ Result_price = mysql_query ("SELECT * FROM Product where Price <1000 and Category = '$ _ GET [categories]'");
}
}
}
Why echo p_L is executed when both boxes select Please Choose;
$ Result_price = mysql_query ("SELECT * FROM Product where Price <1000 ");
Instead of echo Please_choose;
Expert advice
------ Solution --------------------
When a form is submitted, the value of the other form is not set, instead of being equivalent to pleaseChoose. Therefore, your background logic judgment is incorrect. let's take a look.
------ Solution --------------------
I told you everything. Put it in a form, and it will be much easier to do.