title: Populate listbox with data from database
body: <pre><code>&lt;?php
  ini_set("display_errors","on");
  $conn = new COM("ADODB.Connection");
     try {
     $myServer = "WTCPHFILESRV\WTCPHINV";
     $myUser = "sa";
     $myPass = "P@ssw0rd";
     $myDB = "wtcphitinventory";   
     $connStr = "...conn string...";
     $conn-&gt;open($connStr); 
           if (! $conn) {
              throw new Exception("Could not connect!");
          }
     }
     catch (Exception $e) {
        echo "Error (File:): ".$e-&gt;getMessage()."&lt;br&gt;";
     }   
  if (!$conn)
    {exit("Connection Failed: " . $conn);}
      $sql_exp = "select * from dbo.PC"; 
    $rs = $conn-&gt;Execute($sql_exp);
   echo "&lt;table&gt;&lt;tr&gt;&lt;th&gt;Desktop Number&lt;/th&gt;&lt;/th&gt;&lt;/tr&gt;";
     while (!$rs-&gt;EOF) {
         set_time_limit(0);    
         echo "&lt;td&gt;CP # &lt;br&gt;".$rs-&gt;Fields("PC_Number")."&lt;/td&gt;";           
        $rs-&gt;MoveNext();
     }   
     echo "&lt;/table&gt;";   
     $rs-&gt;Close();   
         ?&gt;  
  </code></pre>
  
  <p>i would like to have a list box instead of just a print of all the data  of PC_Number from database. All i could do is to echo it and im having a hard time inserting a select. I would like to have a form method post along with a select(listbox)</p>