title: Keeping selected dropdown value
body: <p>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</p>
  
  <pre><code>&lt;select  onclick="document.getElementById('cand_qual4').style.display='none'; " name="oca[]" id="oca"  multiple="multiple"&gt;
  &lt;?php
        $odrop = array('B COM','M COM','BBA','MBA','LLB','LLM','CPA','CIMA','MS FINANCE','DISA','CISA','OTHER');
  
        foreach ($odrop as $odrop1)
        {
          echo '&lt;option value="' . $odrop1 . '"' . (isset($_POST['oca']) &amp;&amp; in_array($odrop1,$_POST['oca'])  ? ' selected' : '') . '&gt;' . $odrop1 . '&lt;/option&gt;';
        } 
   ?&gt;         
  &lt;/select&gt;
  </code></pre>