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');
However, when the first form is submitted, the user is not landed on the anchored DIV, but on the bottom of page.
As you can try on development version http://www.topdodavatel.cz/tuzby/tuzby.php
What could cause that the anchor does not work? If I choose some div that is written in the code above, it works well.
Kindly thank you for your inputs!
This is a common problem it seems, see here or here for a similar problem.
It seems that something along the way, PHP, Apache or your browser strips out the anchor element on redirection.
To make this work I would suggest moving the anchor content
nechajinto a query variabletuzby.php?anchor=nechaj. Then in PHP check for this variable and if it exists use JavaScript to move the user to the correct point. Like this:You'll need to add some kind of input verification check for the
anchorvariable of course.