okay i needed a music player and that could be interactive (next, previous, play and stop) and embed the music in bg since it has been two years since coding anything it took me all day, now the only problem is I cant get the buttons closer together, because I am having to put each one in a different form and the browser forces them apart. I want to be able to place the buttons anywhere on the page cause I have a certain layout where they need to go, here is the whole script:
<?
session_start();
$playnumber = 1;
$stopnumber = 0;
$lastnumber = 6;
if($HTTP_POST_VARS['play'] == 'play') {
if ($SESSION['play'] != '$stopnumber') {
session_register('play');
$SESSION['play'] = $stopnumber;
} else {
session_register('play');
$_SESSION['play'] = $playnumber;
}
}
if ($HTTP_POST_VARS['play'] == 'next'){
if ($SESSION['play'] == '0'){
session_register('play');
$SESSION['play'] = $stopnumber;
} elseif ($SESSION['play'] == '6'){
session_register('play');
$SESSION['play'] = $playnumber;
} else {
$oldnumber = $SESSION['play'];
$nextnumber = $oldnumber + $playnumber;
session_register('play');
$SESSION['play'] = $nextnumber;
}
}
if ($HTTP_POST_VARS['play'] == 'prev'){
if ($SESSION['play'] == '0'){
session_register('play');
$SESSION['play'] = $stopnumber;
} elseif ($SESSION['play'] == '1'){
session_register('play');
$SESSION['play'] = $lastnumber;
} else {
$oldnumber = $SESSION['play'];
$prevnumber = $oldnumber - $playnumber;
session_register('play');
$SESSION['play'] = $prevnumber;
}
}
echo "Currnet Session # is ". $_SESSION['play']."<br />";
$tracknumber = $_SESSION['play'];
?>
<html>
<head>
</head>
<body bgcolor="yellow">
<?
echo "<embed SRC=\"images/T0$tracknumber.mp3\" HIDDEN=\"TRUE\" autostart=\"true\">";
?>
<FORM ACTION="<?=$PHP_SELF?>" METHOD="POST" NAME="previoussong">
<input name="play" type="hidden" id="play" value="prev">
<input type="image" SRC="images/bg.gif" name="submit" value="prev" ALT="previous">
</FORM>
<FORM ACTION="<?=$PHP_SELF?>" METHOD="POST" NAME="nextsong">
<input name="play" type="hidden" id="play" value="next">
<input type="image" SRC="images/bg.gif" name="submit" value="next" ALT="next">
</FORM>
<FORM ACTION="<?=$PHP_SELF?>" METHOD="POST" NAME="playsong">
<input name="play" type="hidden" id="play" value="play">
<input type="image" SRC="images/bg.gif" name="submit" value="play" ALT="play">
</FORM>
</body>
</html>
also here is the example http://comp.uark.edu/~jbmcely/music.php
i only have two samples loaded right now but I made it for six.
note: the echo of current session wont be used just for my testing purposes
If my script can be written better please let me know as I said it has been a while.