繁体   English   中英

提交表单数据后如何转移到另一页的部分?

[英]how can i transfer to section of another page after submit form data?

我想通过POST方法将表单数据发送到另一个页面,以便在我的指定部分中将焦点放在另一个页面上。 我该怎么做?

  <form method="post" id="loginForm" action="/index.php"> <table> <tr> <td><label class="labelShadow">User Name: </label></td> <td><input type="text" name="uName" class="loginBox" value="<?php if(isset($_COOKIE['uName']))echo $_COOKIE['uName']; ?>" /></td> </tr> <tr> <td><label class="labelShadow">Password: </label></td> <td><input type="password" name="pass" class="loginBox" value="<?php if(isset($_COOKIE['pass']))echo $_COOKIE['pass']; ?>" /></td> </tr> <tr> <td colspan="2" style="text-align:center"> <input type="submit" value="Login" name="login" class="btn btn-default" <?php callRouter(); if(isset($_SESSION['privilege']))echo "disabled"; ?>/> <input type="checkbox" class="checkBoxShodow" name="cookieChk" <?php if(isset($_COOKIE['pass']))echo "checked"; ?> /> <label class="labelShadow">&nbsp;remember me</label> </td> </tr> </table> </form> 

如果我正确理解了该问题,则只需要向表单的操作添加锚即可,如下所示:

<form method="post" id="loginForm" action="/index.php#focus-on-section">

锚点可以是其他页面上具有id任何元素:

<div id="focus-on-section">
  more stuff
</div>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM