how to insert when multiple checkboxlist values are selected

hi all,

  I have a problem in inserting multiple selected values in a checkboxlist.

How to handle model in this case. can anyone help me.

I am able to display the column values as checkboxlist.

The code i am working with is

				$model=new Flatchargesmapping;

        $chargecode= array();

        $modelcharge = new Flatchargesmapping;

		// Uncomment the following line if AJAX validation is needed

		// $this->performAjaxValidation($model);




			$chargecode = $modelcharge->Charge_code;

            $flag= "false";

        for ($i=0;$i<count($chargecode);$i++)


         				$model=new Flatchargesmapping;

         		 $model->flat_number = $modelcharge->flat_number;

		          		 $model->Charge_code = $chargecode[$i];





				  if (!$model->save()) {

  								 	 echo "didn't work";

								     Yii::app()->end(); // don't use die();









Take a look at this: