title: How to save the multi selected fields on save in Yii web app
body: <p>I am new to Yii , i have created an application in that form i have created an field as multi select option as shown below ......Can any one help me how to save the data into my mysql table for that what changes i have to do and where i have to change  .. I want to save the each department which are selected have to be saved as  rows </p>
  
  <pre><code> &lt;?php 
       $data = array('101' =&gt; 'CSE', '102' =&gt; 'IT', '103' =&gt; 'EEE', '104' =&gt; 'ECE');
  $selected   = array(
    '102' =&gt; array('selected' =&gt; 'selected'),
    '103' =&gt; array('selected' =&gt; 'selected'),
  );
  $htmlOptions = array('size' =&gt; '5', 'prompt'=&gt;'Use CTRL to Select Multiple Staff', 'multiple' =&gt; 'true', 'options' =&gt; $selected);
      echo $form-&gt;listBox($model, 'department',$data, $htmlOptions, array('rows' =&gt; 6, 'cols' =&gt; 50, 'class' =&gt; 'text_area')); ?&gt;
  &lt;/div&gt;
  </code></pre>