title: php drop-down menu from MYSQL, how to return other column value?
body: <p>I'm having a input form that asks for a location. The locations are stored in a mysql db and have an id (colomn: id and column: location).</p>
  
  <p>I have a drop down menu that is generated from those records in the db:</p>
  
  <pre><code>    &lt;select name="location"&gt;
  
      &lt;?php                         
              $query="SELECT location FROM locations";
                  $result=mysql_query($query) or die;
  
              while ($row=mysql_fetch_array($result)) {
  
              $location=$row['location'];
  
              echo "&lt;option&gt;$location&lt;/option&gt;";
      ?&gt;
  
      &lt;/select&gt;
  </code></pre>
  
  <p>This all works. When the form is sumbitted, I obviously get a POST[location] for example "Belgium".</p>
  
  <p>Let's say Belgium is the location in my db and has id 5, how can I return the ID as the POST variable from the dropdown box, instead of the location. Ofcourse I want the dropdown to show the locations, and not the ID's.</p>
  
  <p>Thanks in advance!</p>