title: Check if select option selected
body: <p>I have a form where I post some options to a mysql query. When it returns, it a draw a table with some data.</p>
  
  <p>How to set the select box's option to be selected if my form returned?</p>
  
  <p>I tried this, but not working:</p>
  
  <pre><code>&lt;form method="post" id="partnersearchform"&gt;
  &lt;input type="hidden" name="formaction" value="partnersearch"&gt;
  Partner Típus&lt;br&gt;
  &lt;select onchange="document.getElementById('partnersearchform').submit();" size="" name="ceg"&gt;
  &lt;option value=""&gt;(mind)&lt;/option&gt;
  &lt;option value="1" if($ceg==1){ print 'selected'; }&gt;Magánszemélyek&lt;/option&gt;
  &lt;option value="2" if($ceg==2){ print 'selected'; }&gt;Cégek&lt;/option&gt;
  &lt;/select&gt;
  &lt;/form&gt;
  </code></pre>