title: PHP - How to get the selected item from dropdown menu populated from query before POST
body: <p>I would like to know how do I get the selected name from a dropdown menu, being populated by a query using phpmyadmin, to display a picture according to the selection.</p>
  
  <p>For example, if the users selects "Mountains" from the drop down menu I want to be able to use that value and make another query to get the specific image URL from the database and display it, and every time the user changes selection the image changes accordingly. </p>
  
  <p>And yes, I know, mysql commands are deprecated.
  If you need any more details let me know.</p>
  
  <pre><code>&lt;select name='picker'&gt;";
  &lt;?php   
  mysql_connect('localhost','root','');
  mysql_select_db('...');
  $sql = "...";
  $result = mysql_query($sql);
  
  while ($row = mysql_fetch_array($result)) {
          echo "&lt;option value='" . $row['name'] . "'&gt;" . $row['name'] ."&lt;/option&gt;";
          }
  
            $selectoption = $_REQUEST['picker'];
        mysql_connect('localhost','root','');
        mysql_select_db('...');
        $sql3 = "...";    
        $image = mysql_query($sql3);
  ?&gt;
  
  &lt;img src="&lt;?php echo $image; ?&gt;"&gt;
  </code></pre>