title: Change the selected value from combo-box in edit form
body: <p>I would like to make use of the existing insertion form as edit form for user to make any changes in existing record, the following coding is getting the value which passing from another form</p>
  
  <pre><code>&lt;?php $error=""; if (isset($_GET['id'])) { $id=$_GET['id']; include checkpo.php';
  if (checkpono($id)==true &amp;&amp; checkpostatus($id)==true) {
      include 'db.php';
      $select_PO=mysql_query("SELECT pono, bu, dept, dor, quote1, quote2, quote3 FROM tb_po WHERE pono = '". $id ."' AND postatus !='Approved' AND pono NOT IN (SELECT pono FROM tb_postatus)", $conn);
      $count=mysql_num_rows($select_PO);
              if ($count == 1) {
                  $row=mysql_fetch_array($select_PO);
              }
  mysql_close($conn);
  
  }
  else {
      die("The PO No. ". $id ." does not allow to edit &lt;a href='searchpo.php'&gt;Return&lt;/a&gt; to previous page.");
  }}
  </code></pre>
  
  <p>but i do not know how to set the selected value in combo-box and allow the user make changes.
  sorry, what i want is that, the values (from mysql) in combo-box "dept" are "HR", "Admin", Finance" and "PR" and when the record passed to this form, the selected value (i.e "HR") in combo-box "dept" which is posted in mysql before, so when user select the pull down menu, they can change the value either from "HR", "Admin", Finance" and "PR".</p>
  
  <pre><code>&lt;?php
      include 'db.php';
      $query = "SELECT dept FROM tb_dept";
      $result = mysql_query($query);
      ?&gt;
      &lt;select id="dept" name="dept" style="width: 126px"&gt;
      &lt;?php
          while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
      ?&gt;
      &lt;option value="&lt;?php echo $line['dept'];?&gt;"&gt; &lt;?php echo $line['dept'];?&gt;&lt;/option&gt;
      &lt;?php }
      ?&gt;
      &lt;/select&gt;
  </code></pre>