开发者

How to load mysql data on option html form

开发者 https://www.devze.com 2022-12-21 05:10 出处:网络
I have this option form: <tr> <td><font size=\"3\">Civil Status</td> <td>:</td>

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

精彩评论

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