自动滚动到页面底部

vin*_*ent 2 php anchor

我在我的网页底部有一个表单,当我提交表单和页面刷新时,我希望页面自动定位在页面底部,这样我再次看到表单.是否有可能在不使用任何javascript的情况下实现这一点,只能使用php.

Mat*_*att 6

是.您可以使用链接的name属性执行此操作.

在页面底部有这样的代码:

<!-- The page with the form (script.php) -->
<?php
  //Other page content
?>
<a name="bottomOFThePage"></a>
<?php
 //Your form
?>

<!--
    PHP page that handles the form submit
    Use the header code from netcoder's answer below
-->
<?php
  //Process your form
 header('Location: script.php#bottomOfPage');
?>
Run Code Online (Sandbox Code Playgroud)

将表单提交到http://yoururl.com/script.php#bottomOfThePage后重定向