Keeping selected dropdown value

I have this drop-down and user can select multiple options ,how can i keep selected value on form after submit button, if error comes on form\[code\]<select onclick="document.getElementById('cand_qual4').style.display='none'; " name="oca[]" id="oca" multiple="multiple"><?php $odrop = array('B COM','M COM','BBA','MBA','LLB','LLM','CPA','CIMA','MS FINANCE','DISA','CISA','OTHER'); foreach ($odrop as $odrop1) { echo '<option value="' . $odrop1 . '"' . (isset($_POST['oca']) && $_POST['oca'] == $odrop1 ? ' selected' : '') . '>' . $odrop1 . '</option>'; } ?> </select>\[/code\]
 
Back
Top