title: How to set multiple select options by default from array
body: <p>I'm trying to retrieve options/values from my database in the from of an array i would like to set these option/values as selected by default in a multiple select list and display them to the user where they will be able to updated their data if necessary.</p>
  
  <pre><code>//data in database
  $mytitle = array(
      'Arbitrator',
      'Attorney',
      'Student',
      'Other'
  ); 
  
  //data for multiple select
  $title = array(
      'Judge' ,
      'Magistrate' ,
      'Attorney' ,
      'Arbitrator',
      'Title Examiner' ,
      'Law Clerk','Paralegal' ,
      'Intern' ,
      'Legal Assistant',
      'Judicial Assistant',
      'Law Librarian' ,
      'Law Educator' ,
      'Attorney',
      'Student',
      'Other'
  );
  
  echo "&lt;select name='title[]' multiple='multiple'&gt;";
  
  $test = implode(',', $mytitle);
  
  for ($i=0; $i&lt;=14; $i++) {
      if($test == $title[$i]) {
          echo "&lt;option selected value='$title[$i]'&gt;$title[$i]&lt;/option&gt;";
      }
      else {
          echo "&lt;option value='$title[$i]'&gt;$title[$i]&lt;/option&gt;";
      }
  }
  
  echo "&lt;/select&gt;"; 
  </code></pre>