在POST表单提交后使用Anchor

use*_*509 9 html php web-applications

我需要在用户单击按钮Post后让页面加载到页面中的特定标签.

注意:我正在使用PHP

表格代码示例:

<form action="po.php?id=44" method="POST">
   <input type="hidden" name="here" value="#here" />
   <input name="btn_send" type="submit" value="Post" />
</form>
Run Code Online (Sandbox Code Playgroud)

页面应该位于页面中某个标题之间的某个位置

如下所示

代码示例:

<a name="here"></a>
<p>Total Number of Posts 55</p>
Run Code Online (Sandbox Code Playgroud)

如你所见,我登陆的地方是一个普通的标签文字,而不是超链接.因此,我将锚线作为标题之前的指标.

问题:

页面没有落在我放的地方(name ="here").该页面登顶.有没有简单的方法让它落在(名字="这里")?

Phi*_*hil 13

只需在表单的action属性中包含片段,例如

<form method="post" action="po.php?id=44#here">
Run Code Online (Sandbox Code Playgroud)

此外,使用ID属性作为片段位置要好得多.丢失空锚并将段落更改为...

<p id="here">Total number of Posts 55</p>
Run Code Online (Sandbox Code Playgroud)