Skip to content Skip to sidebar Skip to footer

Use Anchor After POST Form Submission

I need to let the page loads at specific label within a page after user clicks the button Post. Note: i'm using PHP Form Code Sample:

Solution 1:

Simply include the fragment in your form's action attribute, eg

<form method="post" action="po.php?id=44#here">

Also, using ID attributes as fragment locations is much nicer. Lose the empty anchor and change your paragraph to...

<p id="here">Total number of Posts 55</p>

Solution 2:

Try this:

<form action="po.php?id=44#here" method="POST">
   <input name="btn_send" type="submit" value="Post" />
</form>

And put this on the target page:

<a id="here"></a>
<p>Total Number of Posts 55</p>

Solution 3:

header("Location: url#fragment");

Post a Comment for "Use Anchor After POST Form Submission"