lqwlpx 2021-01-08 16:37 采纳率: 0%
浏览 75

请问我想要用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条回答 默认 最新

  • ww_xx_yy 2021-01-21 10:55
    关注

    我理解的是php是运行在服务器上的语言,这样就导致php不能监听浏览器上面的动作。

    要是我处理的话我会用js来处理,判断浏览器的输入变化,然后实现功能

    评论

报告相同问题?

悬赏问题

  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题