title: php combobox default selected
body: <p>Imagine that:</p>
  
  <p>A field that could be YES or NO -> Active: Yes | Active: No</p>
  
  <p>So, i got a query that returns it for each client.</p>
  
  <p>I want to show the results in a form, and I should be able to edit that and save on BD again.</p>
  
  <p>I can almost do it, but I need that the default value be wich was already saved on BD, and what I have atm seems show the last row or something.</p>
  
  <p>I want that show the current status or be able to change it for (Yes or NO)</p>
  
  <p>It goes like this for the combobox:</p>
  
  <pre><code>$sql = "SELECT * FROM client,sector WHERE client.idClient = '$id' AND sector.idSector=client.Sector_idSector ";
  $result = mysql_query($sql);
  
  while($row = mysql_fetch_array($result))
  {
  
  &lt;select name="alterar_sector" id="sectorbox" &gt;
      &lt;?php 
      while($row = mysql_fetch_array($result))
      {
      echo '&lt;option value="'.$row['idSector'].'"&gt;'.$row['idSector'].' - '.$row['Nomesec'].'&lt;/option&gt;';
      }
  
      ?&gt;
      &lt;/select&gt;
  
  }
  </code></pre>
  
  <p>Dont give importance of info displayed like "sector" or even the query etc..</p>
  
  <p>Resume:</p>
  
  <p>I want that combobox could display the current value as default and give a list of anothers possible values to change.</p>
  
  <p>Thank you :)</p>