Help regarding the checkboxes

Hi my database(edu) has a table(patientinfo) which has a field(options) it is a enum datatype having {one,two,three} already predefined

  1. How can i display {one,two,three} in check boxes one below the other

  2. Is enum correct datatype to display check-boxes

Use checkBoxList

For an enum field should be more appropriate a dropdown list or a radio button list, as the user cannot select more than one value.

Can you please let me know the datatype i should choose for checkboxes?

You should use a boolean or an int(1) for each checkbox.

Then you create your checkbox as:

<?php echo $form->checkbox($model, 'checkBoxField1');?>

<?php echo $form->checkbox($model, 'checkBoxField2');?>

<?php echo $form->checkbox($model, 'checkBoxField3');?>

<?php echo $form->checkbox($model, 'checkBoxField4');?>

where checkboxFiled1-2-3-4 are the field in database.