title: Dropdown selected based on URL parameter - PHP or jQuery?
body: <p>What's the best method to output "selected" for my form select based on the URL parameter? </p>
  
  <p>In my URL I might have this parameter &amp;term=retail. </p>
  
  <p>How could I tell the below code to select the retail option?</p>
  
  <pre><code>&lt;select class="form-control" name="term" id="saleTerm"&gt;
          &lt;option value="all-residential" selected&gt;All Residential&lt;/option&gt;
          &lt;option value="apartment"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Apartment&lt;/option&gt;
          &lt;option value="villa"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Villa&lt;/option&gt;
          &lt;option value="all-commercial"&gt;All Commercial&lt;/option&gt;
          &lt;option value="office"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Office&lt;/option&gt;
          &lt;option value="retail"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Retail&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>