title: Format SQL form output
body: <p>This is my form page:</p>
  
  <pre><code>&lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
  &lt;title&gt;Log&lt;/title&gt;
  &lt;/head&gt;
  &lt;h1&gt; Log &lt;/h1&gt;
  &lt;form method="get" action="getlog2.php"&gt; 
  &lt;table width="300" border="0"&gt;
    &lt;tr&gt;
  &lt;td&gt; Forte ID:&lt;/td&gt;
  &lt;td&gt;&lt;select id="ForteID" name="ForteID"&gt;                    
                  &lt;option value="'nc4682'"&gt;nc4682&lt;/option&gt;
                  &lt;option value="'bs1441'"&gt;bs1441&lt;/option&gt;
                  &lt;option value="'sp3212'"&gt;sp3212&lt;/option&gt;                 
      &lt;/select&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/table&gt;
  
   &lt;input type="submit" name="getLog" value="Get Log"&gt;&lt;input type="button" value="Form" onClick="window.location.href='index.php';"&gt;
   &lt;/form&gt; 
  
  &lt;/head&gt;
  </code></pre>
  
  <p>This code here is what I have for my form when I click the button "Get Log".</p>
  
  <pre><code>&lt;?php
  /*print_r($_POST);*/
  $serverName = 'SRB-Nick_Desktop\SQLEXPRESS';
  $connectionInfo = array('Database'=&gt;'cslogs', 'UID'=&gt;'cslogslogin', 'PWD'=&gt;'123456','ReturnDatesAsStrings'=&gt;true,);
  $connection = sqlsrv_connect($serverName, $connectionInfo);
  
  $query = 'SELECT ForteID, Disposition, appNumber, Finance_Num, Num_Payments, ACH_CC, Notes, Date from cslogs.dbo.logs WHERE ForteID = ' . $_GET['ForteID'];
  
  $result = sqlsrv_query($connection,$query);
  /*echo $_GET['ForteID'];*/
  if (!$result)
  
  {
  /*echo $query;*/
  $message = 'ERROR: ' . sqlsrv_errors();
  return $message;
  }
  else
  { 
  $i = 0;
  echo '&lt;html&gt;&lt;body&gt;&lt;table&gt;&lt;tr&gt;';
  while ($i &lt; sqlsrv_num_rows($result))
  {
      $meta = sqlsrv_fetch($result, $i);
      echo '&lt;td&gt;' . $meta-&gt;name . '&lt;/td&gt;';
      $i = $i + 1;
  }
  echo '&lt;/tr&gt;';
  
  while ( $row = sqlsrv_fetch_array( $result, SQLSRV_FETCH_ASSOC ))
  {
      $count = count($row);
      $y = 0;
      echo '&lt;tr&gt;';
      while ($y &lt; $count)
      {
          $c_row = current($row);
          echo '&lt;td&gt;' . $c_row . '&lt;/td&gt;';
          next($row);
          $y = $y + 1;
      }
      echo '&lt;/tr&gt;';
  }
  sqlsrv_free_stmt ($result);
  
  echo '&lt;/table&gt;&lt;/body&gt;&lt;/html&gt;';
  }
  sqlsrv_close( $connection);
  ?&gt;
  </code></pre>
  
  <p>It then goes to a page where this is output:</p>
  
  <pre><code>bs1441  LOC asldjfasdf  srb-000001  1   cc  collected payment   2012-11-07
  </code></pre>
  
  <p>I want to format the output with borders and headers, is that possible?  Thanks in advance!</p>