提交表单并刷新到页面底部 [英] Submit a form and refresh to the bottom of the page

查看:45
本文介绍了提交表单并刷新到页面底部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在php中提交表单时,我正在使用:"header('Location:contact.php');"点击提交后重定向到当前页面.但是,表单位于页面底部,每当单击提交时,它将被重定向回页面顶部.无论如何,有没有重定向回到页面底部?

when submitting a form in php i am using: "header('Location: contact.php');" to redirect back to the current page after hitting submit. However the form is at the bottom of the page and each time submit is hit it is redirected back to the top of the page. is there anyway to redirect back to the bottom of the page?

推荐答案

是的,您可以将ID设为要返回的页面的一部分,然后再返回该页面,请参见以下代码:

Yes, You can take a id to part of a page you want to return to and then return to it, see following code:

例如,您要返回到波纹管div:

for example you want to return to bellow div:

<div id="bottom"></div>

您的php代码以重定向到此:

your php code to redirect to this:

header('Location: contact.php#bottom');

这篇关于提交表单并刷新到页面底部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆