title: populating drop down list using data column and get user's selected item
body: <p>i have here code in populating my drop down list using data from the database. It works fine but i got stuck on getting user's selected item and put it in a variable, can anyone help? here's the code:</p>
  
  <pre><code>&lt;?php   
  // declare database connection variables.
  $host = "localhost";
  $username = "root";
  $password = "";
  $db_name = "sample";
  $tbl_name = "tbl_company";
  
  // connect to server and select database.
  mysql_connect("$host", "$username", "$password")or die("cannot connect");
  mysql_select_db("$db_name")or die("cannot select DB");
  
  $sql = "SELECT type FROM $tbl_name";
  $result = mysql_query($sql) or die(mysql_error());
  
  $dropdown = "&lt;select name='items' class='select'&gt;";
  
  while ($row = mysql_fetch_assoc($result)) {
      $dropdown .= "\r\n&lt;option value='{$row['type']}'&gt;{$row['type']}&lt;/option&gt;";
  }
  $dropdown .= "\r\n&lt;/select&gt;";
  
  echo $dropdown; 
  ?&gt;
  </code></pre>