I have a selection box that I am populating from a MySQL table. It is a "multiple" select box, and when I do my search, the box is pulling in the full list from my table (as intended), and is highlighting the items I want as "selected". However, my problem is twofold: 1) the items are duplicated, and 2) all selected items are at the bottom of the list. Ex. I have a list of "apples", "oranges", "peaches", and "pears". My retrieved data shows "apples" and "pears" chosen. My list goes as follows: "apples", "oranges", "peaches", "pears", "apples (selected)","pears (selected)". Here is the code snippet that I am using:
while($row = mysql_fetch_array($sql_result)) {
print "<option value =".$row["pprod_id"];
if($row["part_id"] == $row["pprod_id"])
{
print " selected ";
}
print ">".$row["prod_desc"]."</option>\n";
}
Sorry for the long post, but any information is helpful.
Thanks!!
--Jim