php查询结果的分页显示,点击下一页时不能记住所查询的东西,只要点击下页时, 显示出来的 结果却是全部数据 。
<?php<br />// 获取select值<br />$select_value = isset($_GET['select']) ? $_GET['select'] : '';<br />//echo $select_value;<br /><br />//执行查询SQL<br />if($select_value==""){<br /> _page("SELECT o_id FROM t_order",5);<br /> $_result= mysql_query("SELECT * FROM t_order ORDER BY createtime DESC LIMIT $_pagenum,$_pagesize");<br />}<br />if($select_value=="option1"){<br /> _page("SELECT o_id FROM t_order where status=0",4);<br /> $_result1= mysql_query("SELECT * FROM t_order where status=0 ORDER BY createtime DESC LIMIT $_pagenum,$_pagesize");<br /> //echo _num_rows($_result);<br /> <br />}<br />if($select_value=="option2"){<br /> _page("SELECT o_id FROM t_order where status=1",20);<br /> $_result= mysql_query("SELECT * FROM t_order where status=1 ORDER BY createtime DESC LIMIT $_pagenum,$_pagesize");<br />}<br />if($select_value=="option3"){<br /> _page("SELECT o_id FROM t_order where status=2",20);<br /> $_result= mysql_query("SELECT * FROM t_order where status=2 ORDER BY createtime DESC LIMIT $_pagenum,$_pagesize");<br />}[code=php]<br /><form action='order.php' style="margin-left:20px;"><br /><select name="select"><br /> <option value="">全部状态</option><br /> <br /> <option value="option1" <?php<br /> // 如果在上面获取的值和这个option里的值一样,<br /> // 就打印selected,让这个option默认被选中<br /> echo $select_value == 'option1' ? 'selected' : '' <br /> ?>>未付款</option><br /> <option value="option2" <?php <br /> echo $select_value == 'option2' ? 'selected' : ''<br /> ?>>已付款待取件</option><br /> <option value="option3" <?php <br /> echo $select_value == 'option3' ? 'selected' : ''<br /> ?>>已取件待送洗</option><br /> </select> <br /> <input type="submit" value="查询" /><br /> </form><br />[