我有一张桌子("场地"),存放志愿者可以工作的所有场地,每个志愿者被分配到一个场地工作.
我想从场地表创建一个选择下拉列表.
现在我可以显示每个志愿者分配的场地,但是我希望它显示下拉框,并且已经在列表中选择了场地.
例如,id为7的志愿者被分配到venue_id 4
Brochure Distribution option will already be selected when it displays the drop down list, because in the volunteers_2009 table, column venue_id is 4.我知道它将采用for或while循环的形式从场地表中拉出场地列表
我的查询是:
$query = "SELECT volunteers_2009.id, volunteers_2009.comments, volunteers_2009.choice1, volunteers_2009.choice2, volunteers_2009.choice3, volunteers_2009.lname, volunteers_2009.fname, volunteers_2009.venue_id, venues.venue_name FROM volunteers_2009 AS volunteers_2009 LEFT OUTER JOIN venues ON (volunteers_2009.venue_id = venues.id) ORDER by $order $sort";
如何从场地桌面填充场地(volunteers_2009.venue_id,venues.id)的选择下拉框并让它预先选择列表中的场地?
$query = "SELECT volunteers_2009.id, volunteers_2009.comments, volunteers_2009.choice1, volunteers_2009.choice2, volunteers_2009.choice3, volunteers_2009.lname, volunteers_2009.fname, volunteers_2009.venue_id, venues.venue_name FROM volunteers_2009 AS volunteers_2009 LEFT OUTER JOIN venues ON (volunteers_2009.venue_id = venues.id) ORDER by $order $sort"; $res = mysql_query($query); echo "";
:)