比如:跳转到 1,2,3,4...
echo "<tr style=background-image:url(img/new_hader_27.jpg) height=30 style=color:#ffffff style=font-size:13px;><th>选择</th><th>酒店id</th><th>开始时间</th><th>结束时间</th><th>内容介绍</th><th>备注</th><th>s_type</th><th>操作</th></tr>";
$ziduan = isset($_POST['ziduan'])?$_POST['ziduan']:(isset($_GET['ziduan'])?$_GET['ziduan']:"");
$txt_sousuo = isset($_POST['txt_sousuo'])?$_POST['txt_sousuo']:(isset($_GET['txt_sousuo'])?$_GET['txt_sousuo']:"");$where = "where 1";
if(!empty($ziduan) && !empty($txt_sousuo)){
$where .= " and $ziduan like '%{$txt_sousuo}%'";
}
$sql = "SELECT count(*) as countnum FROM hotel_activities_2 $where";
$result=mysql_fetch_array(mysql_query($sql));
$countnum = $result['countnum'];
if(!$countnum) die("<script>alert('查询的数据不存在');window.location='chaxun.php';</script>");$rowsPerPage=10;
$maxPage=ceil($countnum/$rowsPerPage);
$page=isset($_GET['curPage'])?intval($_GET['curPage']):1;
$page = $page<1?1:$page;
$page = $page>$maxPage?$maxPage:$page;$start=$rowsPerPage*($page-1);
$sel1 = "SELECT * FROM hotel_activities_2 $where order by h_id limit $start,$rowsPerPage";
$result=mysql_query($sel1) or die("查询失败");
//循环输出表中各个字段值
echo '<form action="delect_sj.php" method=post>';
while ($row = mysql_fetch_array($result)) {
echo '<tr align="center" class="shu">';
echo '<td><input type=checkbox name="hid[]" value="'.$row['h_id'].'"></td>';
echo '<td>'.$row['hotel_id'].'</td>';
echo '<td>'.$row['start_date'].'</td>';
echo '<td>'.$row['end_date'].'</td>';
echo '<td>'.$row['content'].'</td>';
echo '<td>'.$row['source'].'</td>';
echo '<td>'.$row['s_type'].'</td>';
echo '<td>'.' <a href="upedit.php?hid='.$row['h_id'].'" >编辑</a> '.'</td>';
echo '</tr>';
}
echo '<input type=submit value="删除所选" onclick="return delconfirm()"></form>';
if($page>1) {
$prevPage=($page-1)<1?1:$page-1;
echo "<a href='?ziduan={$ziduan}&txt_sousuo=".rawurlencode($txt_sousuo)."&curPage=$prevPage'><img src='img/prev.gif'/></a>";
}
if ($page<$maxPage) {
$nextPage=($page+1)>$maxPage?$maxPage:$page+1;
echo "<a href='?ziduan={$ziduan}&txt_sousuo=".rawurlencode($txt_sousuo)."&curPage=$nextPage'><img src='img/next.gif'/></a>";
} echo "<div align='right' class='shu'><a href='?ziduan={$ziduan}&txt_sousuo=".rawurlencode($txt_sousuo)."&curPage=1'>首页</a>
"." 共".$maxPage."页 当前为第".$page."页"."".
" <a href='?ziduan={$ziduan}&txt_sousuo=".rawurlencode($txt_sousuo)."&curPage=$maxPage'>尾页</a>";
echo "</table>";
echo "<tr style=background-image:url(img/new_hader_27.jpg) height=30 style=color:#ffffff style=font-size:13px;><th>选择</th><th>酒店id</th><th>开始时间</th><th>结束时间</th><th>内容介绍</th><th>备注</th><th>s_type</th><th>操作</th></tr>";
$ziduan = isset($_POST['ziduan'])?$_POST['ziduan']:(isset($_GET['ziduan'])?$_GET['ziduan']:"");
$txt_sousuo = isset($_POST['txt_sousuo'])?$_POST['txt_sousuo']:(isset($_GET['txt_sousuo'])?$_GET['txt_sousuo']:"");$where = "where 1";
if(!empty($ziduan) && !empty($txt_sousuo)){
$where .= " and $ziduan like '%{$txt_sousuo}%'";
}
$sql = "SELECT count(*) as countnum FROM hotel_activities_2 $where";
$result=mysql_fetch_array(mysql_query($sql));
$countnum = $result['countnum'];
if(!$countnum) die("<script>alert('查询的数据不存在');window.location='chaxun.php';</script>");$rowsPerPage=10;
$maxPage=ceil($countnum/$rowsPerPage);
$page=isset($_GET['curPage'])?intval($_GET['curPage']):1;
$page = $page<1?1:$page;
$page = $page>$maxPage?$maxPage:$page;$start=$rowsPerPage*($page-1);
$sel1 = "SELECT * FROM hotel_activities_2 $where order by h_id limit $start,$rowsPerPage";
$result=mysql_query($sel1) or die("查询失败");
//循环输出表中各个字段值
echo '<form action="delect_sj.php" method=post>';
while ($row = mysql_fetch_array($result)) {
echo '<tr align="center" class="shu">';
echo '<td><input type=checkbox name="hid[]" value="'.$row['h_id'].'"></td>';
echo '<td>'.$row['hotel_id'].'</td>';
echo '<td>'.$row['start_date'].'</td>';
echo '<td>'.$row['end_date'].'</td>';
echo '<td>'.$row['content'].'</td>';
echo '<td>'.$row['source'].'</td>';
echo '<td>'.$row['s_type'].'</td>';
echo '<td>'.' <a href="upedit.php?hid='.$row['h_id'].'" >编辑</a> '.'</td>';
echo '</tr>';
}
echo '<input type=submit value="删除所选" onclick="return delconfirm()"></form>';
if($page>1) {
$prevPage=($page-1)<1?1:$page-1;
echo "<a href='?ziduan={$ziduan}&txt_sousuo=".rawurlencode($txt_sousuo)."&curPage=$prevPage'><img src='img/prev.gif'/></a>";
}
if ($page<$maxPage) {
$nextPage=($page+1)>$maxPage?$maxPage:$page+1;
echo "<a href='?ziduan={$ziduan}&txt_sousuo=".rawurlencode($txt_sousuo)."&curPage=$nextPage'><img src='img/next.gif'/></a>";
} echo "<div align='right' class='shu'><a href='?ziduan={$ziduan}&txt_sousuo=".rawurlencode($txt_sousuo)."&curPage=1'>首页</a>
"." 共".$maxPage."页 当前为第".$page."页"."".
" <a href='?ziduan={$ziduan}&txt_sousuo=".rawurlencode($txt_sousuo)."&curPage=$maxPage'>尾页</a>";
echo "</table>";
怎么在下拉菜单中显示共多少页
echo "<div align='right' class='shu'><a href='?rizhiziduan={$rizhiziduan}&txt_ss=".rawurlencode($txt_ss)."&curPage=1'>首页</a>
"." 共".$maxPage."页 当前为第".$page."页".
" <a href='?rizhiziduan={$rizhiziduan}&txt_ss=".rawurlencode($txt_ss)."&curPage=$maxPage'>尾页</a> ";
echo "跳转至:";
echo "<select name='tiaozhuan' style='width:80px;'>";
echo "<option value='select=select'>请选择</option>";
echo "<option value='1'></option>";
echo "<option value='2'></option>";
echo "<option value='3'></option>";
echo "<option value='4'></option>";
echo "</table>";
<?php
echo (" <select name='select' onchange='javascript:location=this.options[this.selectedIndex].value' >");
for($k=1;$k<=$maxPage;$k++){
if ($k==(int)($page)){
echo ("<option value='?page=".$k."' selected>".$k."</option>");
}
else{
echo("<option value='?page=".$k."' >".$k."</option>");
}
}
echo ("</select>");
?>