I have to display the checked box as I am getting the value in $selected
variable. Currently in the below scenario i have to show two checkboxes as checked, but my code is not working. How can i fix?
$checkboxarray = [
'0' => "By Value",
'1' => "By Quantity",
'2' => "By Date"
];
$selected = explode(",", "0,1");
echo $this->Form->select('mo_type', $checkboxarray, array( 'selected' => $selected, 'multiple' => 'checkbox'));
You can try the default instead of selected attribute,
And the proper method is to use "val" attribute