Questions about phpform

Source: Internet
Author: User
Tags php form
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.