I am new to yii framework.
<div class="col-md-5">
<input id="ytAdd_Employee_varHobbies" type="hidden" value="" name="Add_Employee[varHobbies]">
<span id="Add_Employee_varHobbies">
<input id="Add_Employee_varHobbies_0" value="5" type="checkbox" name="Add_Employee[varHobbies][]">
<label for="Add_Employee_varHobbies_0">BaseBall</label>
<br>
<input id="Add_Employee_varHobbies_1" value="2" type="checkbox" name="Add_Employee[varHobbies][]">
<label for="Add_Employee_varHobbies_1">Football</label>
<br>
<input id="Add_Employee_varHobbies_2" value="4" type="checkbox" name="Add_Employee[varHobbies][]">
<label for="Add_Employee_varHobbies_2">Hockey</label>
<br></div>
Here i have multiple checboxes as array in the name of Add_Employee[varHobbies][]
In the controller i saved the form as
$model->attributes=$_POST['Add_Employee'];
//print_r($model);exit;
$image_upload=$model->Image = CUploadedFile::getInstance($model,'Image');
if( $model->validate() && $model->save())
{ }
By using $model->save() all my fields are saved properly but this check box saved as array.
In my model i set the rules as
array('varHobbies', 'type', 'type' => 'array', 'allowEmpty' => false),
I want to save the hobbies as 1,2,3 and so on....
But it is saved as 'array'.
How to fix this?
Please help me