1

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>
1
  • Your HTML is not well formed, and we need the MySQL table layout, plus what information your reading from what table. Also, how do you want the form to be submitted? GET or POST? Commented Feb 27, 2010 at 7:49

1 Answer 1

2
$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...

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.