How To Set Checkboxlist Value?

I have $value and $name how to set in checkBoxList

I try this but not work




$val = array(5311,5312,5415);

$name = array("bob","jack","admin");

echo $this->checkBoxList($model,'mybox',$name,array('value'=>$val));



the third argument should be an associative array like that

$arr = array(5311=>"bob",5312=>"jack",5415=>"admin");


echo $form->checkBoxList($model, 'mybox', $arr);

So, that was the problem ?


public string checkBoxList(CModel $model, string $attribute, array $data, array $htmlOptions=array ( ))

The $data is your check list options, which should be value-label pairs used to generate the check box list. Note, the values will be automatically HTML-encoded, while the labels will not.