Hi!
I do currently have two tables.. The first is music_group_db and is:
group_id | music_group_name
and another table for the songs, song_db and is:
song_id | song_title | rel_group_name_id
I have this script which allows me to select a group from a drop-down list and add a song, and it does so successfully. A problem I am having though, is that it displays the ID number associated with the group and not the group name itself. How do I display the group name instead of the ID?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional">
<html>
<head>
<title>Create Song Record</title>
</head>
<body>
<?php
// Connect to database
$connect= mysql_connect("localhost","root")
or die("Could not connect to database in localhost !");
mysql_select_db("music")
or die("Could not select that database !");
$music_group_name=$HTTP_POST_VARS['music_group_name'];
echo'
<table>
<TR>
<form name="form3" method="post" action="song_title_added.php">
<td COLSPAN="2" bgcolor="#FF0099"><b><center />Add Song </b></td>
</TR>
<TR>
<TD><b>Song Title:</b></TD>
<TD><input type=text name="song_title" size=40></TD>
</TR>
<TR>
<TD><B>Music Group Information:</B></TD>
<TD><select name="rel_group_name_id" tabindex="4"><option value="notset">- Select a Group -</option> ';
//--- CREATE DEPONENT SELECT ---
$sql = "SELECT DISTINCT music_group_name, group_id FROM music_group_db ORDER BY music_group_name";
$music_group_name = mysql_query($sql) or die($sql . '<br />' . mysql_error());
while ($row = mysql_fetch_array($music_group_name)) {
echo '<option value="' . $row['group_id'] . '">' . $row['music_group_name'] . '</option>';
} ;
echo '</select></TD>
</TR>
<TR>
<TD COLSPAN=2><center><br><input type="submit" name="Submit" value="Submit" action="required"></center></TD></FORM>
</TR>
</TABLE>
</body>
</html> ';
?>