Home > Backend Development > PHP Tutorial > [分页]怎样实现跳转页面功能?解决办法

[分页]怎样实现跳转页面功能?解决办法

WBOY
Release: 2016-06-13 10:03:46
Original
1002 people have browsed it

[分页]怎样实现跳转页面功能?
怎样实现跳转页面功能?

比如说有个输入框,输入任何一个数字,点击“跳至”按钮,就立即跳转到这个页面。

我应该怎样做?下面是我的代码,全贴上来了

PHP code
  <br>  
Copy after login

 
   
 
 
   
   
   
   
   
 
//当前页数
$page = isset($_GET['page'])?intval($_GET['page']):1;
//每页记录数
$each_page = 5;
//查询留言总数
$res = mysql_query("SELECT COUNT(*) FROM wyx_class");
$total = mysql_result($res, 0);
//总页数
$total_page = ceil($total/$each_page);
//计算真实的页数,使得页数总是落在1~$total_page之间
$page = ($page $page = ($page>$total_page)?$total_page:$page;
//根据真实的页数值,计算偏移量
$offset = ($page-1)*$each_page;
//尾页
$lastpg=ceil($total/$each_page);
//上一页
$prestart=$page-1;
//下一页
$nextpage=$page+1;

$SQL="select * from wyx_class order by wyx_classsort asc limit $offset,$each_page";
$Result=mysql_query($SQL);
while($Row=mysql_fetch_array($Result))
{
$wyx_id=$Row["wyx_id"];
$wyx_classname=$Row["wyx_classname"];
$wyx_classsort=$Row["wyx_classsort"];
?>
   
   
   
   
   
   
 
}
?>
 
   
 
栏目管理
编号 栏目名称 排序 编辑 删除
编辑 删除
 

if($page>1){
//如果页数大于1,则激活显示“前一页”的按钮
?>

}else{
//这里非激活显示“前一页”的按钮
?>


 
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template