Multiple-condition group search (i)

Source: Internet
Author: User
Usually when we are developing a system, we will not lack the benten. Often, however, it is impossible to satisfy the requirements of the user, so we should set the multiple conditions to combine, let use the user's search to make it easier to select the conditions and quickly find the records they are satisfied with.
Now we're going to start a clock watch. The company's customer subscription system, which has a customer subscription number, type, name, quantity, price, and so on, does not list the data in one by one. The list is as follows:
Subscription number (ID) TYPE name (name) quantity (QTY) (price)
001 Movement 1 100 150
001 Table Shell Table Shell 1 1000 60
001 Ribbon Belt 1 500 70
002 Movement 2 200 40
002 Table Shell Table Shell 2 300 53
002 Ribbon Belt 2 400 46
Now we want to build a discovery system so that the user can, according to the order number, or according to the type, or according to the price, or a combination of each of them can be a quick search, the symbol is as follows:
The following section is a form that displays a search

?
$linkstr =mysql_connect ("localhost", "root", "sa");
mysql_select_db ("CX", $LINKSTR);
?>
<script language= "JavaScript" >
function variable ()
{
if (document.search.select1.value!= "1")
{
if (document.search.no.value== "")
{
Window.alert ("Please input the number of subscribers!");
return false;
}
Else
{
if (document.search.type.value== "")
{
Window.alert ("Please choose accessories!");
return false;
}
}
}
Else
{
if (document.search.select2.value!= "1")
{
if (document.search.price.value== "")
{
Window.alert ("Please input price!");
return false;
}
}
}
}
</script>
<br>
<center><font size= "5" ><b> multiple conditions Group Search </b></font></center>
<br>
<body>
<form action= "searchjg.php" method= "POST" name= "Search" >
<table align= "Center" border= "1" width= ">"
<tr>
&LT;TD align= "left" width= "MB" > Subscription number </td>
Align= "left" width= "&LT;TD" ><input type= "text" name= "no" ></td>
</tr>
<tr>
&LT;TD align= "left" width= ">"
<select name= "Select1" >
<option selected value= "1" >
<option value= "2" > or
<option value= "3" > and
</select>
</td>
&LT;TD align= "left" width= ">"
<select name= "Type" >
<option selected>
?
$querystring = "SELECT distinct type from Orders";
$result =mysql_query ($querystring, $LINKSTR);
while (list ($type) =mysql_fetch_row ($result))
{
echo "<option value=" $type ">". $type;
}
?>
</select>
</tr>
<tr>
<td>
<select name= "Select2" >
<option selected value= "1" >
<option value= "2" > or
<option value= "3" > and
</select> Price in
</td>
<td><select name= "Price" >
<option selected>
<option value= "1" >50 below
<option value= "2" >50~200?
<option value= "3" >200 above
</select> Accessories
</td>
</tr>
<table width= "align=" "Right" >
<tr>
<td>
<input type= "Submit" name= "Submit" value= "Start Inquiry" >
</td>
</tr>
</table>
</table>
</form>
</body>

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.