我是这里的新用户。我正在尝试使用CRM系统的搜索过滤器创建一个简单的分页。搜索和显示记录有五个过滤选项。我想要每页100条记录,我的过滤选项在第一页上完美运行。问题是,当我点击下一页或第二页以显示搜索数据的下一个100条记录时,它将重置所有过滤器值并显示100条记录,我可以在不选择任何过滤值的情况下获得这些记录。我正在寻找这个问题的解决方案,以便我可以根据给定的过滤值得到下一页。
下面我给出了控制器和视图页面的分页部分,
Controller page
if (!isset($_GET['page']) or !is_numeric($_GET['page'])) {
$page = 0;
} else {
$page = (int)$_GET['page'];
}
$customerslist = array();
$customers = $db->query("select cu.email, cu.notinterested, cu.version, cu.autoresponder, cu.customer_support, cu.verified, cu.verified_date, cu.customer_id, cu.customer_name, cu.address, cu.telephone_no, cu.email, cu.person_incharge, cu.designation, ct.city_name, st.state_name, emp.username from customers as cu left join state as st on st.id = cu.state left join city as ct on ct.id = cu.city left join tbllogin as emp on emp.employee_id = cu.customer_support
where cu.customer_name!='' and cu.customer_support>0 and cu.company_id='".$cid."' ".$cont." ".$order_by." limit ".$page.",100");
foreach($customers->fetchAll() as $cl) {
$customerslist[] = $cl;
}
view page
<?php
$nextt = $page + 100;
if ($sno > 100)
echo '<a href="?controller=customers&action=index&cid='.$cid.'&page='.$nextt.'"><b>Next<b></a>';
$prev = $page - 100;
?> <?php
if ($prev >= 0)
echo '<a href="?controller=customers&action=index&cid='.$cid.'&page='.$prev.'"><b>Previous<b></a>';
?>
答案 0 :(得分:0)
首先总是使用GET方法提交搜索表单:
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<footer id="footer" class="midnight-blue">
<div class="container">
<div class="row text-center">
<div class="col-sm-6 col-xs-12">
© 2013 <a target="_blank" href="" title="">Layout</a>. All Rights Reserved.
</div>
<div class="col-sm-6 col-xs-12">
<ul class="list-unstyled list-inline ">
<li><a style="color:#000" href="#">Home</a></li>
<li><a style="color:#000" href="#">About Us</a></li>
<li><a style="color:#000" href="#">Faq</a></li>
<li><a style="color:#000" href="#">Contact Us</a></li>
</ul>
</div>
</div>
</div>
</footer>