我有一个从数据库表研讨会中的所有标题填充的下拉列表。我希望第一个选项是使用seminarsID在特色表中选择的选项。 “顶级功能”正确显示第一个选项。当您看到下拉框时,“第二个功能”为空白,但是当您单击以查看所有选项时,第一个选项是特色表中的正确选项。
以下是代码:
<div class='formInput'>Top Feature: <select name='seminarID1' id='seminarID1'>
<?php
$myquery = mysql_query("
SELECT id, title
FROM seminars
WHERE id in
(SELECT seminarsID from featured WHERE ID = 1)
");
while($get_row = mysql_fetch_assoc($myquery)){?>
<option value='<?php echo $get_row['id']?>'><?php echo $get_row['title'];
?></option><?php }
$rs = mysql_query("
SELECT id, title
FROM seminars
WHERE Active = 'Active'
order by title
");
while($get_row = mysql_fetch_assoc($rs))
echo "<option value='{$get_row['id']}'>{$get_row['title']}</option>";
?>
</select></div>
<div class='formInput'>2nd Feature: <select name='seminarID2' id='seminarID2'>
<?php
$myquery = mysql_query("
SELECT id, title
FROM seminars
WHERE id in
(SELECT seminarsID from featured WHERE ID = 2)
");
while($get_row = mysql_fetch_assoc($myquery)){?>
<option value='<?php echo $get_row['id']?>'><?php echo $get_row['title'];
?></option><?php }
$rs = mysql_query("
SELECT id, title
FROM seminars
WHERE Active = 'Active'
order by title
");
while($get_row = mysql_fetch_assoc($rs))
echo "<option value='{$get_row['id']}'>{$get_row['title']}</option>";
?>
</select></div>