title: Dynamically pull from a database depending on dropdown result
body: <p>I am currently pulling the information I need from my database but would like the information being displayed to change dependant on the dropdown result. I have done some research and think the best way to do this will be using a form but am not sure how it will work.</p>
  
  <p>Here is the code I have below:</p>
  
  <pre><code>      &lt;section id="compare"&gt;
  
      &lt;select&gt;
        &lt;option&gt;Select Gym&lt;/option&gt;       
        &lt;option&gt;fitness first&lt;/option&gt;
        &lt;option&gt;anytime fitness&lt;/option&gt;
        &lt;option&gt;the gym&lt;/option&gt;
        &lt;option&gt;its leisure ltd&lt;/option&gt;
        &lt;option&gt;the armoury&lt;/option&gt;
      &lt;/select&gt;
      &lt;select&gt;
        &lt;option&gt;Select Gym&lt;/option&gt;       
        &lt;option&gt;fitness first&lt;/option&gt;
        &lt;option&gt;anytime fitness&lt;/option&gt;
        &lt;option&gt;the gym&lt;/option&gt;
        &lt;option&gt;its leisure ltd&lt;/option&gt;
        &lt;option&gt;the armoury&lt;/option&gt;      
      &lt;/select&gt;
  
      &lt;section id="left"&gt; 
      &lt;?php
  
      mysql_select_db("gyms", $con);
      $result = mysql_query("SELECT * FROM gym WHERE id='1'") or die ('Error: '.mysql_error ());
  
          while($row = mysql_fetch_array($result)){
            echo "&lt;h1&gt;" . $row['name'] . "&lt;/h1&gt;";
            echo "&lt;p&gt;&lt;h6&gt;type&lt;/h6&gt;" . $row['type'] . "&lt;/p&gt;";
            echo "&lt;p&gt;&lt;h6&gt;price&lt;/h6&gt;" . $row['price'] . "&lt;/p&gt;";
            echo "&lt;p&gt;&lt;h6&gt;hours&lt;/h6&gt;" . $row['hours'] . "&lt;/p&gt;";
            echo "&lt;p&gt;&lt;h6&gt;parking&lt;/h6&gt;" . $row['parking'] . "&lt;/p&gt;";
            echo "&lt;p&gt;&lt;h6&gt;facilities&lt;/h6&gt;" . $row['facilities'] . "&lt;/p&gt;";
            } 
      ?&gt;      
      &lt;/section&gt;
  
      &lt;section id="right"&gt;
      &lt;?php
      $result = mysql_query("SELECT * FROM gym WHERE id='2'") or die ('Error: '.mysql_error ());
  
          while($row = mysql_fetch_array($result2)){
            echo "&lt;h1&gt;" . $row['name'] . "&lt;/h1&gt;";
            echo "&lt;p&gt;&lt;h6&gt;type&lt;/h6&gt;" . $row['type'] . "&lt;/p&gt;";
            echo "&lt;p&gt;&lt;h6&gt;price&lt;/h6&gt;" . $row['price'] . "&lt;/p&gt;";
            echo "&lt;p&gt;&lt;h6&gt;hours&lt;/h6&gt;" . $row['hours'] . "&lt;/p&gt;";
            echo "&lt;p&gt;&lt;h6&gt;parking&lt;/h6&gt;" . $row['parking'] . "&lt;/p&gt;";
            echo "&lt;p&gt;&lt;h6&gt;facilities&lt;/h6&gt;" . $row['facilities'] . "&lt;/p&gt;";
            } 
  
      mysql_close($con);
      ?&gt;
      &lt;/section&gt;
  
    &lt;/section&gt;    
  </code></pre>