title: PHP and SQL Server Express to retrieve and show data
body: <p>I am looking to take a PHP page to retrieve data based on the selection from a drop down list, then show the results based on that selection.  I am not even sure where to begin except my connection to the database.  I do also know that I have to have a query statement, like I would in SQL, which here is a little bit of that:</p>
  
  <pre><code>$sql = "SELECT ForteID, Disposition, appNumber, Finance_Num, Num_Payments, ACH_CC, Notes, Date
  FROM   cslogs.dbo.Logs
  WHERE  ForteID = 'bs1441'";
  </code></pre>
  
  <p>The bs1441 is just an example of one option that would be in the drop down list.  I am not sure what I would put there for it to put in there automatically from the list.</p>
  
  <p>Thanks for the help in advance.  Sorry if there is not enough information to go on, but not sure what even would be needed at this point.</p>
  
  <p>EDIT:</p>
  
  <p>This is what I have so far:</p>
  
  <pre><code>&lt;form method="get" action="getlog.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;/form&gt; 
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  &lt;?php
  $serverName = 'SRB-Nick_Desktop\SQLEXPRESS';
  $connectionInfo = array('Database'=&gt;'cslogs', 'UID'=&gt;'cslogslogin', 'PWD'=&gt;'123456');
  $connection = sqlsrv_connect($serverName, $connectionInfo);
  
  $result = sqlsrv_query( $connection, 
                  'SELECT ForteID, Disposition, appNumber, Finance_Num, Num_Payments, ACH_CC, Notes, Date
                  FROM    Logs
                  WHERE   (ForteID = $ForteID)', 
                     array($ForteID));
  
  while($row = sqlsrv_fetch_array($result))
  {
  echo($row['ForteID'] . ', '.
       $row['Disposition'] . ', '.
       $row['appNumber'] . ', '.
       $row['Finance_Num'] . ', '.
       $row['Num_Payments'] . ', '.
       $row['ACH_CC'] . ', '.
       $row['Notes'] . ', '.
       $row['Date']);
  }
  sqlsrv_close( $connection);
  ?&gt;
  </code></pre>
  
  <p>Then when I look at the page it throws this error:</p>
  
  <p>Parse error: syntax error, unexpected T_STRING in C:\wamp\www\cslogs\getlog.php on line 46</p>
  
  <p>Line 46 is this line:</p>
  
  <pre><code>    echo($row['ForteID'] . ', '.
  </code></pre>
  
  <p>Let me know if that helps!</p>