多重?l件?M合查?(一)
时间:2021-06-22 09:36:29|栏目:PHP代码|点击: 次
平常我??在?_?l系?y?r,一定不??缺少查?弁?然而往往算???l件是?o法?M足用?舻囊?求的,?@?r我??就????O置多重?l件?M行?M合,?用?舨樵??r以更加方便地?x?癫樵??l件,迅速找到他??所?M足的??.
?F在我??假?O?_?l一???表公司的客?粲??蜗到y,有客?粲??尉??,??e,名?Q,?盗?,价格等?Y料,?@里就不?①Y料一一列??,.??伪砣缦?:
??尉??(ID) ??e(TYPE)名?Q(NAME)?盗?(QTY) 价格(PRICE)
001 机芯 机芯1 100 150
001 表?? 表??1 1000 60
001 表?? 表??1 500 70
002 机芯 机芯2 200 40
002 表?? 表??2 300 53
002表?? 表??2 400 46
?F在我???O想要建一??查?系?y,?用?艏纯筛?据??尉??,也可根据??e,或者根据价格,或者其中的各自?M合????F快速查?,代?如下:
下面此部分是?@示查??l件的窗体
<html>
<?
$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("??入??翁??a!");
return false;
}
else
{
if (document.search.type.value=="")
{
window.alert("??x?衽浼???e!");
return false;
}
}
}
else
{
if (document.search.select2.value!="1")
{
if (document.search.price.value=="")
{
window.alert("??入价格!");
return false;
}
}
}
}
</script>
<br>
<center><font size="5"><b>多重?l件?M合查?</b></font></center>
<br>
<body>
<form action="searchjg.php" method="POST" name="search" onsubmit="return variable(this.value)">
<table align="center" border="1" width="400">
<tr>
<td align="left" width="100">??尉??</td>
<td align="left" width="300"><input type="text" name="no"></td>
</tr>
<tr>
<td align="left" width="200">
<select name="select1">
<option selected value="1">
<option value="2">或者
<option value="3">而且
</select>??e??
</td>
<td align="left" width="200">
<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">或者
<option value="3">而且
</select>价格位在
</td>
<td><select name="price">
<option selected>
<option value="1">50以下
<option value="2">50~200?
<option value="3">200以上
</select>的配件
</td>
</tr>
<table width="400" align="right">
<tr>
<td>
<input type="submit" name="submit" value="?_始查?">
</td>
</tr>
</table>
</table>
</form>
</body>
</html>
?F在我??假?O?_?l一???表公司的客?粲??蜗到y,有客?粲??尉??,??e,名?Q,?盗?,价格等?Y料,?@里就不?①Y料一一列??,.??伪砣缦?:
??尉??(ID) ??e(TYPE)名?Q(NAME)?盗?(QTY) 价格(PRICE)
001 机芯 机芯1 100 150
001 表?? 表??1 1000 60
001 表?? 表??1 500 70
002 机芯 机芯2 200 40
002 表?? 表??2 300 53
002表?? 表??2 400 46
?F在我???O想要建一??查?系?y,?用?艏纯筛?据??尉??,也可根据??e,或者根据价格,或者其中的各自?M合????F快速查?,代?如下:
下面此部分是?@示查??l件的窗体
<html>
<?
$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("??入??翁??a!");
return false;
}
else
{
if (document.search.type.value=="")
{
window.alert("??x?衽浼???e!");
return false;
}
}
}
else
{
if (document.search.select2.value!="1")
{
if (document.search.price.value=="")
{
window.alert("??入价格!");
return false;
}
}
}
}
</script>
<br>
<center><font size="5"><b>多重?l件?M合查?</b></font></center>
<br>
<body>
<form action="searchjg.php" method="POST" name="search" onsubmit="return variable(this.value)">
<table align="center" border="1" width="400">
<tr>
<td align="left" width="100">??尉??</td>
<td align="left" width="300"><input type="text" name="no"></td>
</tr>
<tr>
<td align="left" width="200">
<select name="select1">
<option selected value="1">
<option value="2">或者
<option value="3">而且
</select>??e??
</td>
<td align="left" width="200">
<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">或者
<option value="3">而且
</select>价格位在
</td>
<td><select name="price">
<option selected>
<option value="1">50以下
<option value="2">50~200?
<option value="3">200以上
</select>的配件
</td>
</tr>
<table width="400" align="right">
<tr>
<td>
<input type="submit" name="submit" value="?_始查?">
</td>
</tr>
</table>
</table>
</form>
</body>
</html>
上一篇:php addslashes 利用递归实现使用反斜线引用字符串
栏 目:PHP代码
下一篇:PHP开发微信支付的代码分享
本文标题:多重?l件?M合查?(一)
本文地址:http://www.codeinn.net/misctech/146256.html






