jump to anchor after POST

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jhilden
Forum Newbie
Posts: 4
Joined: Tue Mar 15, 2005 3:50 pm

jump to anchor after POST

Post by jhilden »

I have a large page with many submit buttons that POST to PHP_SELF. After a user clicks one of the submit buttons I want the page to scroll/jump to the submit button they pushed.

Before each button I have

Code: Select all

<a name='$Counter'></a>
How can I make the page jump/scroll without the user having to click one of these:

Code: Select all

<a href='#$Counter'>
???

Thanks in advance for the help.
Cheers
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

change the URL they submit to so that it includes the hash you want them to jump to.
jhilden
Forum Newbie
Posts: 4
Joined: Tue Mar 15, 2005 3:50 pm

Post by jhilden »

That's an elegent solution, here's my new code that does exactly what I want it to:

Code: Select all

<a name='$Counter'></a>			
			  <form action='get_pic.php#$Counter' method='post'>
Post Reply