PHP标头位置-使用HTML锚点重定向到URL [英] PHP Header Location - redirect to URL with HTML anchor

查看:103
本文介绍了PHP标头位置-使用HTML锚点重定向到URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个网站,在提交表单后,用户将通过标题位置"重定向到同一页面,但具有锚点以填写另一张表单.

I have a website, where after submission of a form user is redirected throught Header Location to the same page but with anchor to fill in another form.

Header('Location: http://www.topdodavatel.cz/tuzby/tuzby.php#nechaj');

但是,在提交第一个表单时,用户不会落在锚定的DIV上,而是在页面底部.

However, when the first form is submitted, the user is not landed on the anchored DIV, but on the bottom of page.

您可以尝试使用开发版本 http://www.topdodavatel.cz/tuzby/tuzby .php

As you can try on development version http://www.topdodavatel.cz/tuzby/tuzby.php

什么会导致锚不起作用?如果我选择上面代码中编写的div,则效果很好.

What could cause that the anchor does not work? If I choose some div that is written in the code above, it works well.

非常感谢您的投入!

推荐答案

感谢大家的积极性.结果表明,DIV的主要问题是从数据库获取内容并且未设置固定高度,这导致该DIV暂时溢出.

Thank everyone for your initiative. It showed up that major issue was with DIV that obtained content generated from database and did not have set fixed height, which caused temporary overflow of that DIV.

因此,我通过将元素的高度设置为"overflow:hidden"(在样式正确加载之前)对其进行了修复.

So I fixed it by setting a height to the element and overflow:hidden (before the style loads properly).

这篇关于PHP标头位置-使用HTML锚点重定向到URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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