我的阵列是这样的:
Array
(
[9] => Yashobanta
[80] => Yash
[83] => Ramesh
)
,所选数组是:
Array
(
[9] => Yashobanta
[83] => Ramesh
)
我的ctp输入是这样的:
<?php
echo $this->Form->input('Dispensary.role', array(
'options' => $dispensary_users,
'class' =>'form-control dispensary_users_dd',
'label'=>false,
'style'=>'width:300px;',
'multiple'=>true,
'id' => 'editDispensaryRole')
);
?>
我得到了这个:
答案 0 :(得分:0)
试试这个
$options = array(
'9' => 'Yashobanta'
'80' => 'Yash'
'83' => 'Ramesh'
);
$selected = array(
'9' => 'Yashobanta'
'83' => 'Ramesh'
);
echo $this->Form->input('Dispensary.role',
array(
'multiple' => true,
'options' => $options,
'selected' => $selected
)
);