Name: __________
ID:__________
Genre 1 _______
Genre 2________
Medium 1_______
Medium 2__________
Does this makes sense?
Yes, and how about a function to do that?
make the fextfields to the other inputs, then use the function to make these dropdowns:
where:
-$id - this is the name of your table's id field
-$label - Before the dropdown it shows a text
-$var - this will be your dropdown's variable name
-$table - the table's name
-$field - which field you want to print as an option
-$selected - lets add the actual value of this 'row', and this option will be selected as default
<?php
/*
sample
make_list($id, $label, $var, $table, $field, $selected) ;
*/
make_list("genre_id","Genre 1","Genre1","Genre","genre", $row["genre_id_1"]);
make_list("genre_id","Genre 2","Genre2","Genre", "genre", $row["genre_id_2"]);
make_list("med_id","Medium 1","Medium1","Medium","medium", $row["medium_id_1"]);
make_list("med_id","Medium 2","Medium2","Medium","medium", $row["medium_id_2"]);
/*... take this function on the beggining of your code...*/
function make_list($id,$label,$var,$table,$field,$selected)
{
$sql="SELECT $field,$id FROM $table ORDER BY $field";
print "$label: ";
print "<select name=\"$var\">";
print "<option value=\"\"></option>";
$res=mysql_query("$sql");
while( $row = mysql_fetch_assoc( $res))
{
if($selected==$row["$id"])
print "<option value=\"".$row["$id"]."\" SELECTED>". htmlspecialchars(stripslashes($row["$field"]))."</option>\r";
else
print "<option value=\"".$row["$id"]."\">". htmlspecialchars(stripslashes($row["$field"]))."</option>\r";
}
print "</select>";
}
?>