i have two tables
staff
stid, staff
1| lien
2| tony
3| tom
4| henry
bill
billid, stid
1| 1,3
i need for it to display all the staff from the staff table in a multiselect box then have the staff in the bill table selected.
i can't figure out how to do this.
this code below currently only displays the staff table. any help would be appreciated.
<tr>
<td width="10%" align="right"><div class="label">Staff</div></td>
<td>
<SELECT name='stid[]' class="one_pixel_border" size=5 multiple>
<?
$sQuery = mysql_query("SELECT stid, staff FROM staff");
while ($sRow = mysql_fetch_row($sQuery))
{
if( $stid == $sRow[0] ) {
print ("<OPTION SELECTED value='$sRow[0]'>$sRow[1]</OPTION>");
} else {
print ("<OPTION value='$sRow[0]'>$sRow[1]</OPTION>");
} // end of conditions
} // end of while loop
?></SELECT>
</td>
</tr>