PHP Header Location - redirect to URL with HTML anchor

前端 未结 3 1293
梦如初夏
梦如初夏 2021-01-27 00:04

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(\         


        
相关标签:
3条回答
  • 2021-01-27 00:38

    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 nechaj into a query variable tuzby.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:

    window.location.hash='<?php echo $_GET["anchor"] ?>';
    

    You'll need to add some kind of input verification check for the anchor variable of course.

    0 讨论(0)
  • 2021-01-27 00:55

    Name is important

    Give submit button like this

    <input type="submit" name="submits" value="Done" />
    

    in the submit box name is required need to submit the form

    Provide name in your submit in your site check out it will work

    0 讨论(0)
  • 2021-01-27 01:01

    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.

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

    0 讨论(0)
提交回复
热议问题