lqwlpx
lqwlpx
2021-01-08 16:37

请问我想要用PHP实现文本框输入数字跳转功能怎么实现?

  • php

<input type="text" name="page" id="page" size="3">

      <input type="hidden" name="pages" value="<?php echo $page_count;?>">
       <input type="submit" name="Submit" value="跳转">

<?php
session_start();
include_once("002.php");
if ($_GET[page]=="") {$_GET[page]=1;};

$page_size=10;
$offset=@$_REQUEST["offset"];
if(empty($offset)){
	$offset=0;
	$this_page_no=1;
	$pages=1;
 
}


?>
<!DOCTYPE html>
<html>
<head>
	<title>会员管理</title>
	<link href="css/main.css" rel="stylesheet" type="text/css">
  <link href="css/min.css" rel="stylesheet" type="text/css">
    <link href="css/table.css" rel="stylesheet" type="text/css">


<script language="javascript">
 function chk(form){
 if(form.page.value<=0||form.page.value>form.pages.value){
 alert("您输入的页码无效!!");
 form.page.focus();
 return(false);
 }
 return(true);
 }
</script>
</head>
<body>
<table border="1" width="85%" cellspacing="0" align="center">
	<tr align="center">
		<td width="15%"><div align="center">会员号</div></td>
		<td width="15%"><div align="center">姓名</div></td>
		<td width="15%"><div align="center">密码</div></td>
		<td width="15%"><div align="center">性别</div></td>
		<td width="15%"><div align="center">出生日期</div></td>
		<td width="10%"><div align="center">操作</div></td>
	</tr>
	
<?php
include_once("002.php");
$sql="select * from huiyuan ";
$result=mysqli_query($conn,$sql);
$count=mysqli_num_rows($result);


$sql1="select * from huiyuan limit $offset,$page_size";
$result=mysqli_query($conn, $sql1);

while ($s=mysqli_fetch_row($result)) {
	echo "<tr>";
	echo "<td width=15%>$s[0]</td>";
	echo "<td width=15%>$s[1]</td>";
	echo "<td width=15%>$s[2]</td>";
	echo "<td width=15%>$s[3]</td>";
	echo "<td width=15%>$s[4]</td>";
	echo "<td width=10% align='center'>
	<a href='xg.php ?hyh=$s[0]'>修改</a>&nbsp;&nbsp;&nbsp;
	  <a href='sc.php?hyh=$s[0]'>删除</a></td>";
	echo "</tr>";
 
}
?>
<div class="tabe_div">

<form name="from2" method="post" action="cx.php" >
 <p class="p_line text_ient">
 <a class="find_a"><font face="STHupo">会员号:</font></a>
 <input type="text" class="form_input text_ient" name="hyh" size="25" placeholder="请输入会员号">
	<input type="submit" name="cx" value="查询" class="but_find" >
</form>

    </div>
    
<form name="from1" method="post" action="<?php echo $_SERVER['PHP_SELF'];?>" >
	<table width="100%" border="0" cellspacing="0">

	<p align="center">记录数:<?php echo $count; ?>&nbsp;&nbsp;&nbsp;&nbsp;

		
			<a href="<?php echo $_SERVER['PHP_SELF'];?>
			?offset=0" target=_self>首页</a>&nbsp;&nbsp;
			<?php
			if ($offset){
				$preoffset=$offset-$page_size;
				echo "<a href='$_SERVER[PHP_SELF]?offset=$preoffset' target='_self'> 上一页</a>&nbsp;&nbsp;";
			}
			else
				echo "上一页&nbsp;&nbsp;";
			$nextoffset=$offset+$page_size;
			if ($nextoffset<$count) {
				echo "<a href='$_SERVER[PHP_SELF]?offset=$nextoffset' target='_self'>下一页</a>&nbsp;&nbsp;";
			}
			else
			 echo "下一页";
			$pages=ceil($count/$page_size);
			$lastoffset=($pages-1)*$page_size;
			$this_page_no=ceil($offset/$page_size)+1;
			
			?>
		<a href="<?php echo $_SERVER['PHP_SELF'];?>?offset=<?php echo $lastoffset; ?>" target=_self>尾页</a>&nbsp;&nbsp;&nbsp;&nbsp;

		页次:<font face="Microsoft YaHei" color="red"><?php echo $this_page_no;?></font>/
		<?php
		echo $pages;
		?>
		页
		&nbsp;&nbsp;&nbsp;&nbsp;


			

		<input type="text" name="page" id="page" size="3">

      <input type="hidden" name="pages" value="<?php echo $page_count;?>">
       <input type="submit" name="Submit" value="跳转">
      
	</p>
	
  <p align="center" class="p_table">
  
<a href="tj.php" class="a_add" id="add_box" onclick="openlayer('')">添加</a>
<input type="submit"  class="a_add" id="add_box" value="重置" class="btn4">
</p></form>


</table>

</body>
</html>

 

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

1条回答