I have a table of CD releases - each CD has it's own ID.

Then I have a table of the track listings - each track has it's own row, and an ID column linking back to the relevant release

This table's structure is this :

-ID (the ID of the corresponding release in the other table)
-track_number
-track_name
-track_url (an optional link to a real audio clip)
-disk (ie if it's a 4CD box set, if it's on the 1,2,3rd or whatever)

Now, my problem is with adding the links to Real AUdio clips to the tracks.

This is the code I'm currently using to go about it, but as you'll be able to see, it's flawed as I cannot work out a way to distinguish each disk, because at the moment there can be this situation :

eg. Release ID 5 has 3 CD's - I want to add a track_url link to track 3 on disk 1, yet my system add's it to all disks.

Here is my code :

PHP Code:
<?php

if (!isset($submit)) {

?>


<form action="tracklisting.php" method="post">
<table width="100%" cellspacing="1" cellpadding="2">
<?php

include("/home/klone/db.inc");

$result=mysql_query("SELECT * from releases_tl WHERE ID = '$ID'");

while (
$row mysql_fetch_array($result) ) {

?>

<tr bgcolor='#FFFFFF'>
<td width="20%">
<input type="text" name="track[<?php echo("$row[track_number]"); ?>]">
</td>
<td width="80%"><font face="verdana" size="2"><b>
<?php echo("$row[track_name]"); ?>
</b></td>
</tr>

<?php

}

?>

<tr><td colspan="2" align="left">
<input type="hidden" name="disk" value="<?php echo("$row[disk]"); ?>">
<input type="hidden" name="ID" value="<?php echo("$ID"); ?>">
<input type="submit" name="submit" value="submit">
</td>
</tr>
</form>
</table>

<?php

}

?>

<?php

if ($submit == "submit") {


include(
"/home/klone/db.inc");

while(list(
$key$val) = each($track)) {
if (isset(
$track)) {

mysql_query("UPDATE releases_tl SET

track_url = '
$val' WHERE ID = '$ID' and track_number = '$key' and disk='$disk'

"
);


}
}
echo(
"Tracks added.");
}
?>
Thanks for the help.
James