Jump to content

Jump To Page Anchor After Php_self Form Submit


hp1

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.

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...