开发者

How to load mysql data on option html form

I have this option form:

<tr>
<td><font size="3">Civil Status</td>
<td>:</td>
<td>
    <select name="cs" id="cs">
        <option>Single</option>
        <option>Married</option>
        <option>Widowed</option>

    </select></td></td>

What do I do in order to load it with mysql data, like this one:

<td width="23"><font size="3">Sex</td>
<td width="3">:</td>
<td width="174"><input name="sex" type="text"  maxlength="1" value="<?php echo $row["SEX"]; ?>"></td开发者_如何学Go>


$result = mysql_query(blahblah);

<select name="cs" id="cs">
    <?php
    while ($line = mysql_fetch_array($result)) {
        echo '<option value="' . $line['id'] . '">' . $line['name'] . '</option>';
    }
    ?>
</select>

Something like that should do it. If I understood the question correctly...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜