Jump to content

Jump To Page Anchor After Php_self Form Submit


hp1
 Share

Recommended Posts

Hi All. Been away from PHP for 6 months or so and refreshing an old project. I'm building a site for a musician friend and I have implemented the JW Player. I've used a simple drop down form to allow the user to select different playlists. The problem is that the music player is at the bottom of the page and after the form submits it reloads at the top causing the user to have to scroll back down to the player at the bottom to use the freshly loaded playlist.Is there a way to add an anchor that can be called by the $PHP_SELF? (probably not a good way of describing it but hopefully you get the gist!)Form:

 <form name="loadalbum" method="post" action="<?php echo $PHP_SELF;?>">	<select name="albumselect" onchange='this.form.submit()'>		<option selected>Choose Album</option>		<option value="aiw">All I Wanted</option>		<option value="go">Go!</option>	</select> </form>

Player:

<?phpif(!isset($_POST['albumselect'])){$list='aiw';}else {$list=$_POST['albumselect'];}?><script type="text/javascript">  var so = new SWFObject('player.swf','mpl','350','200','9');  so.addParam('allowfullscreen','true');  so.addParam('flashvars','file=<?php echo 'audio/'.$list.'.xml'; ?>&playlist=over&skin=flashskins24blackBlue.swf');  so.write('player');</script>

Link to comment
Share on other sites

Well, when you follow an on page skip link, say to an element with id 'choice', it adds '#choice' to the URL, so you ought to be able to have the form action be: action='<?php echo "$_SERVER["php_self"]#choice"; ?>'Change 'choice' for the id of the element you want to skip to.

Edited by chibineku
Link to comment
Share on other sites

Well, when you follow an on page skip link, say to an element with id 'choice', it adds '#choice' to the URL, so you ought to be able to have the form action be: action='<?php echo "$_SERVER["php_self"]#choice"; ?>'Change 'choice' for the id of the element you want to skip to.
Hey thanks, that worked great.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...