Php 将查询传递到下一页(分页)

Php 将查询传递到下一页(分页),php,pagination,Php,Pagination,嗨,我想做的是对整个页面进行分页,同时也让用户有机会搜索名称并返回分页结果 这是我的密码 <form method = "POST"> <td> Search:<input name="search_name" type="text" id="t_searchkey" style="width:35%;" placeholder = "Name"> <input type="submit" name="b_find" id="b_find" title=

嗨,我想做的是对整个页面进行分页,同时也让用户有机会搜索名称并返回分页结果

这是我的密码

<form method = "POST">
<td>
Search:<input name="search_name" type="text" id="t_searchkey" style="width:35%;" placeholder = "Name">
<input type="submit" name="b_find" id="b_find" title="Find" value = "Find">  
</td>
那么应该更改什么,以便将所需的查询转到下一页

<?php
if(!isset($_POST['b_find']))
{
$query = "SELECT * FROM reginformation 
               WHERE deleted = 0";
$search_name = "";
}

if(isset($_POST['b_find']))
{
$search_name = trim($_POST['search_name']);

$query = "SELECT * FROM reginformation WHERE name = '$search_name' AND deleted = 0 ";
}
?>

<?php
$result = mysql_query($query) or die(mysql_error());            
?>

<?php
$num_rec_per_page=5;
if (isset($_GET["page"])) { $page  = $_GET["page"]; } else { $page=1; }; 
if (isset($_GET["search"]))
{
    $search_name = $_GET['search'];
}
$start_from = ($page-1) * $num_rec_per_page; 
$query2 =$query . " LIMIT $start_from, $num_rec_per_page"; 
echo "query2 $query2";
$rs_result = mysql_query ($query2); //run the query

while ($row = mysql_fetch_assoc($rs_result)) { 
echo "<tr onClick =window.location='infodetailsresp.php?id=$row[regID]'><td>$row[name]</td><td>$row[emailadd]</td><td>$row[contactno]</td><td>$row[event]</td><td>$row[date_register]</td></tr>";
}; 

//$sql = "SELECT * FROM reginformation"; 
$rs_result = mysql_query($query); //run the query
$total_records = mysql_num_rows($rs_result);  //count number of records
$total_pages = ceil($total_records / $num_rec_per_page); 
?>

<?php
echo "<a href='reglistresp.php?page=1&search=$search_name'>".'|< '."</a> "; // Goto 1st page  

for ($i=1; $i<=$total_pages; $i++) { 
echo "<a href='reglistresp.php?page=".$i."&search=$search_name'>". $i ."</a> "; 
}; 
echo "<a href='reglistresp.php?page=$total_pages&search=$search_name'>".' >| '."</a> "; // Goto last page
?>
if(!isset($_POST['b_find']))