title: <select> dropdown default value
body: <p>I have this code:</p>
  
  <pre><code>if(isset($_POST['search']))
  {
      $res1=mysql_query("SELECT * FROM aircraft where acode = '$_POST[ac]'") or die(mysql_error());
      while($row=mysql_fetch_array($res1))
      {
          $airc=$row['acode'];
          $amode=$row['amodel'];
          $stat=$row['status'];
          $rem=$row['remarks'];
  
      echo "&lt;center&gt;&lt;table&gt;&lt;form name=\"frmMain\" method=\"post\"&gt; 
          &lt;tr&gt;&lt;td&gt;&lt;font face=consolas&gt;&lt;b&gt;Aircraft Code:&lt;/b&gt;&lt;/font&gt;&lt;/td&gt;&lt;td&gt;&lt;input type=text name=arc value='$airc' readonly=readonly&gt;&lt;/td&gt;&lt;/tr&gt;
          &lt;tr&gt;&lt;td&gt;&lt;font face=consolas&gt;&lt;b&gt;Aircraft Model:*&lt;/b&gt;&lt;/font&gt;&lt;/td&gt;&lt;td&gt;&lt;input type=text name=am value='$amode'&gt;&lt;/td&gt;&lt;/tr&gt;
          &lt;tr&gt;&lt;td&gt;&lt;font face=consolas&gt;&lt;b&gt;Status:*&lt;/b&gt;&lt;/font&gt;&lt;/td&gt;&lt;td&gt;&lt;input type=text name=st value='$stat'&gt;&lt;/td&gt;&lt;/tr&gt;
          &lt;tr&gt;&lt;td&gt;&lt;font face=consolas&gt;&lt;b&gt;Remarks:*&lt;/b&gt;&lt;/font&gt;&lt;/td&gt;&lt;td&gt;&lt;input type=text name=rm value='$rem'&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;";
      }
  }
  </code></pre>
  
  <p>On submit 'search' button, this code displays the data from aircraft table. The user is allowed to update the data with the (*) sign.</p>
  
  <p><a href="https://i.stack.imgur.com/DdDIb.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/DdDIb.jpg" alt="enter image description here"></a></p>
  
  <p>Since the Status are the following by default (Available, Not Available), I changed this</p>
  
  <pre><code> &lt;tr&gt;&lt;td&gt;&lt;font face=consolas&gt;&lt;b&gt;Status:*&lt;/b&gt;&lt;/font&gt;&lt;/td&gt;&lt;td&gt;&lt;input type=text name=st value='$stat'&gt;&lt;/td&gt;&lt;/tr&gt;
  </code></pre>
  
  <p>to this, </p>
  
  <pre><code>&lt;tr&gt;&lt;td&gt;&lt;font face=consolas&gt;&lt;b&gt;Status:*&lt;/b&gt;&lt;/font&gt;&lt;/td&gt;&lt;td&gt;&lt;select name=st&gt;
      &lt;option value=Available&gt;Available&lt;/option&gt;
      &lt;option value='Not Available'&gt;Not Available&lt;/option&gt;
  &lt;/select&gt;&lt;/td&gt;&lt;/tr&gt;
  </code></pre>
  
  <p>But I want the dropdown to have it's default value depending on 
  <code>$stat=$row['status'];</code> since this is an update form. </p>
  
  <p>If the data being retrieved has it's status '<strong>Available</strong>', then the dropdown should have it's default value as '<strong>Available</strong>'. </p>
  
  <p>How can I achieve that? I tried <code>&lt;select name=status value='$stat'&gt;</code> but it doesn't work. Any help will be appreciated. Thanks! </p>