-3

我想要表格内的结果,但我无法让它工作......

<form method="post" action="" name="myform">
<div class="overviewLayout">
<label>Naam van de Game:</label>
    <?php
        echo "<select name='naam' id='mySelect'>";
        while ($row = mysql_fetch_assoc($query_game)) {
            echo "<option value='".$row['titel']."'>".$row['titel']."    </option>";
        }
        echo "</select>";
        echo $row['titel']; 

    ?>
<br/>
</div>
</form>

echo 回$row['titel'];显不输出当前选中的标题....

编辑:

我运行的查询是这样的......

$query_game = mysql_query("SELECT * FROM features ORDER BY titel");

while 循环显示表中的所有值。选择一个值时,我想从表中显示该行的结果。

4

1 回答 1

0
form method="post" action="" name="myform">
<div class="overviewLayout">
<label>Naam van de Game:</label>
    <?php
        echo "<select name='naam' id='mySelect'>";
        while ($row = mysql_fetch_assoc($query_game)) {
            echo "<option value='".$row['titel']."'>".$row['titel']."    </option>";
        }
        echo "</select>";
        echo $row['titel']; 

    ?>
<br/>
</div>
</form>

运行此代码:

<script>
    var e = document.getElementById("mySelect");
    var title= e.options[e.selectedIndex].value;
document.write(title);
</script>
于 2013-08-30T12:11:13.703 回答