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