0

我有一个下拉列表,其中包含数据库表研讨会中的所有标题。我希望第一个选项是使用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>
4

0 回答 0