title: PHP Sql-Server Populate HTML table rows in a loop, and input submit issue
body: <p>I have a page which performs a lookup on a database and outputs the following</p>
  
  <p>SUP-1, YES</p>
  
  <p>In my database other than the SUP code the other value is either a YES or NO</p>
  
  <p>I have created a page which outputs the row, and then has the function of updating the database via POST method only values that can change are YES to NO and NO to YES</p>
  
  <p>See my form</p>
  
  <pre><code>&lt;?php
              while ($row = sqlsrv_fetch_array($stmt)){
                  echo "&lt;form action=thispage.php method=post&gt;";
                  echo "&lt;tr&gt;";
                  echo "&lt;td&gt;" . $row['sup_code'] . " &lt;/td&gt;";
                  $result = $row['has_loan'] == "YES" ? "YES" : "NO";
                  $result2 = $result == "YES" ? "YES" : "NO";
                  echo "&lt;td&gt;" . "&lt;select name=loan&gt;
                    &lt;option selected&gt;" . $row['has_loan'] . " &lt;/option&gt;
                    &lt;option value=$result2&gt;$result2&lt;/option&gt;
                  &lt;/select&gt;&lt;/td&gt;";
                  echo "&lt;td&gt;" . "&lt;input type=submit name=update value=update" . " &lt;/td&gt;";
                  echo "&lt;/tr&gt;";
                  echo "&lt;/form&gt;";             
              }
  
          ?&gt;
  </code></pre>
  
  <p>Im trying to out put into the select input value the current status YES or NO but then also trying to update the database if value is changed.</p>
  
  <p>Am I doing this right? </p>