title: How to get the variable from url using $_GET and set it as the default value of the dropdown
body: <p>In the select dropdown, I'm trying to get the variable from URL using $_GET[], and the drop-down selected value will be based on the value get from the URL. 
   Somehow it fails, any thoughts?</p>
  
  <pre class="lang-php prettyprint-override"><code>&lt;select name="ForceSelection"&gt;
    &lt;option value="default" &gt;Select Case&lt;/option&gt; 
    &lt;?php
      include('connect-db.php');
  
      $sql = "SELECT DISTINCT(typename3),id AS id,typename3 FROM vaccinetype";
  
      $result = mysql_query($sql);
  
      while ($row = mysql_fetch_array($result)) {
        echo "&lt;option value='" . $row['id'] . "' if ($row['id'] == '$_GET['typeid']') echo 'selected="selected"'; ?&gt; &gt;" . $row['typename3'] . "&lt;/option&gt;";
      }
   ?&gt;
   &lt;/select&gt;
  </code></pre>