title: How to load data on option box in php
body: <p>I'm having trouble loading the mysql data to the  option box using php. Here's my code:</p>
  
  <pre><code>&lt;?php
  
    $con = mysql_connect("localhost","myuname","mypassword");
  if (!$con)
    {
    die('Could not connect: ' . mysql_error());
    }
  
  mysql_select_db("school", $con);
  
   $idnum= mysql_real_escape_string($_POST['idnum']);
  
    $result = mysql_query("SELECT * FROM student WHERE IDNO='$idnum'");
  ?&gt;
  
  &lt;?php while ( $row = mysql_fetch_array($result) ) { ?&gt;
  
  &lt;tr&gt;
  &lt;td width="30" height="35"&gt;&lt;font size="2"&gt;*I D Number:&lt;/td&gt;
  &lt;td width="30"&gt;&lt;input  name="idnum"  type="text" maxlength="5" value="&lt;?php echo $row["IDNO"]; ?&gt;" readonly="readonly"&gt;&lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  
  <p>My problem is loading it here:</p>
  
  <pre><code>&lt;td&gt;&lt;font size="2"&gt;Gender&lt;/td&gt;
  &lt;td&gt;
      &lt;select name="gender" id="gender"&gt;
          &lt;font size="2"&gt;
          &lt;option value="&lt;?php echo $line['IDNO']; ?&gt; "&gt;&lt;?php $line['GENDER'] ; ?&gt;&lt;/option&gt;
  
  
  
      &lt;/select&gt;&lt;/td&gt;&lt;/td&gt;
  </code></pre>
  
  <p>The table looks like this:</p>
  
  <pre><code>    IDNO | GENDER  
      123  |  M
      321  |  F
  </code></pre>
  
  <p>What am I supposed to do?To load the exact gender corresponding to the IDNO?</p>