i have this form that edits current documents which are stored in a mysql db. these documents can have single or multiple document owners, which are just users specifically picked.
now, i want to dump the whole list of users into the drop-down box, and when i get to the names which were selected in the past, they would be highlighted. my problem is that the names keep on repeating themselves the same number of times there are selected names.
here's my code:
thanks! you guys never failed to help me..^^,
cheers!
now, i want to dump the whole list of users into the drop-down box, and when i get to the names which were selected in the past, they would be highlighted. my problem is that the names keep on repeating themselves the same number of times there are selected names.
here's my code:
Code:
<?
$doc_owners = get_result("SELECT doc_owners.auth_uname FROM doc_owners WHERE ctrl_no = '{$ctrl_no}' ");
while($row = mysql_fetch_row($doc_owners))
$curr_owners[] = $row[0];
$res = get_result("SELECT users.username,users.full_name FROM users,org_roles WHERE users.org_role_id = org_roles.org_role_id ORDER BY org_roles.org_role_id");
while($names = mysql_fetch_row($res))
{
foreach($curr_owners as $i)
{
if ($names[0] != $i)
echo"<option value=".$names[0]." >".$names[1]."</option>";
else{
echo"<option value=".$names[0]." selected='selected'>".$names[1]."</option>";
unset($i);
}
}
}
echo"</select>";
cheers!
Comment