title: Make the option selected based on Url parameter in php
body: <p>I need to select both drop down based on the url parameter</p>
  
  <p>Here is my code</p>
  
  <pre><code> &lt;select id="parent-cat" name="parent-cat" onchange="getFilterUrl(this.value)"&gt;                              
      &lt;option value="www.site.co/?test=101"&gt;Test 1&lt;/option&gt;                                    
      &lt;option value="www.site.co/?test=102"&gt;Test 2&lt;/option&gt;  
   &lt;/select&gt;
  
  &lt;select id="child-cat" name="child-cat" 
  onchange="getFilterUrl(this.value)"&gt;  
  
    &lt;option value="www.site.com/?sample=95"&gt;Sample 1&lt;/option&gt;
     &lt;option value="www.site.co/?sample=96"&gt;Sample 2&lt;/option&gt;
     &lt;option value="www.site.co/?sample=97"&gt;Sample 3&lt;/option&gt;
     &lt;option value="www.site.co/?sample=98"&gt;Sample 4&lt;/option&gt;
     &lt;option value="www.site.co" selected=""&gt;Sample 5&lt;/option&gt;
   &lt;/select&gt;
  
  &lt;script&gt;
    function getFilterUrl(filterurl) {
      var url = filterurl;        
        if (url) { 
            window.location = url; // redirect
        }
        return false;
   }
  &lt;/script&gt;
  </code></pre>
  
  <p>Right now after selecting each drop down, that is refreshed to selected url,</p>
  
  <p>I am looking for code, if we select first drop down, and next one,
  I need to form url like below for second drop down first option.</p>
  
  <p>Example: if Test 1 is selected, then, Sample 1 selected, the Url should be like beloww with both option as selected</p>
  
  <p><strong>site.co/?test=102&amp;sample=95</strong></p>
  
  <p>How this can be done?</p>
  
  <p>Please anyone help me to achieve this.</p>
  
  <p>Thanks</p>