<select name="leibie">
<?php
require('conn/conn.php');
$sql="select * from `099_3`";
$result=$dbh->query($sql);
foreach($result as $row){
echo "<option value=$row[lb_name]>$row[lb_name]
</option>";
}
?>
</select>
<input type="submit" name="sub" value="查找">
</form>
②以分页的形式输出查找结果
<div id="theme">
<?php echo $_POST['leibie'].'>>';?>
</div>
<form action="" method="get">
<table id='gs_info'>
<tr id='tr1'>
<th width='50px'>编号</th>
<th width='150px'>商品名称</th>
<th width='70px'>价格(元)</th>
<th width='60px'>库存量</th>
<th width='100px'>商品照片</th>
<th >商品说明</th>
<th width='110px'>添加时间</th>
<th width='100px'>加入购物车</th>
</tr>
<?php
//传入页码
$page=@$_GET['p']?@$_GET['p']:1;//url 中传入的值
(p=1/2/3...)
//传入分页数据
require("./conn/conn.php");
$pre=($page-1)*10;
$pagesize=10;
$showpage=5;
$i=1;
$leibie=$_POST['leibie'];
$sql="select * from `099_2` where goods_belong=
'$leibie' order by goods_id LIMIT $pre,$pagesize";
$result=$dbh->query($sql);
foreach($result as $row){
$pic=$row['goods_pic'];
评论0