tags:

views:

46

answers:

1

Is there a way to reload a PHP page when a users clicks a PHP link and then have the page jump to a certain spot on the same page using PHP or JQuery like an HTML anchor?

Here is the PHP link below.

<a href="../index.php?uid=' . $user_id . '&view=member">' . $user_name . '</a>
+3  A: 

You can just use a hash link, for example:

<a href="../index.php?uid='.$user_id.'&view=member#section">'.$user_name.'</a>

If in that page you have anything with that ID, say:

<div id="section">

Then it'd scroll down to there, no jQuery or JavaScript needed...this is normal browser behavior. You can read more about it in the HTML4 spec here.

As an example, here's a link to the answer you're reading, see the auto-scroll when you visit it? :)
http://stackoverflow.com/questions/3163053#3163061

Nick Craver
+1 nice explanation nick! it shot me! ;)
Reigel