here is an example from one that i have done, what it does is gets the positions from the open position table with the first while loop, then inside that, there is a while loop finding all the titles from the position table and checks to see if the values match, if they do, then echo selected, that part is in the if
<?
$query1 = "select * from open_position where id = '$id';";
$result1 = mysql_query($query1) or die(mysql_error());
while ($row1 = mysql_fetch_array($result1))
{
?>
Title:<br>
<select name="title" class="text1">
<?
$queryp = "select * from position order by title;";
$resultp = mysql_query($queryp) or die(mysql_error());
while ($rowp = mysql_fetch_array($resultp))
{
?>
<option value="<? echo $rowp['title']; ?>"<? if ($row1['title'] == $rowp['title']) echo " selected"; ?>><? echo $rowp['title']; ?></option>
<?
}
}
?>