Cakephp输入选择多个选定问题,并选择

Cakephp输入选择多个选定问题,并选择,php,cakephp,html-select,Php,Cakephp,Html Select,我有一些基本的问题 echo $this->Form->select('Already.alredyselected',$listnom,array( 'multiple' => 'checkbox', 'label' => 'Text Label', 'selected' => $alreadyinvites, 'class' => 'selbox')); 我的阵列是: $alr

我有一些基本的问题

    echo $this->Form->select('Already.alredyselected',$listnom,array(
        'multiple' => 'checkbox',
        'label' => 'Text Label',
        'selected' => $alreadyinvites,
        'class' => 'selbox'));
我的阵列是:

   $alreadyinvites =  Array(
[258] => Banana Voadora
[196] => Jack Bob Rodrigo Silva Junior)
以及:

)

但是CakePHP 2.4或2.3.2没有打印选中的复选框,我做错了什么?

试试看

$alreadyinvites = array(258, 196);

试试这个:

    $selected = array(2, 3);
    $options = array(1, 2, 3, 4);

echo $this->Form->input('Attendees', array('multiple' => true, 'options' => $options, 'selected' => $selected));

Hash::extract($thiswavegates,{n}.Guest.id');正在以字符串形式返回ID值,而不是Int。。。我进行了调试,发现了问题。但是谢谢你的帮助!我在CakePHP 3.x中遇到了相同的问题,如何解决CakePHP 3.0中的相同问题?@Yogeshuhagiya如果您发布一个新问题来描述您的确切问题,可能会更好通过请求->数据从控制器传递所选值-这是cleanes方法。选定的/值键将在无效/发布时中断表单。
echo $this->Form->select('Already.alredyselected',$listnom,array(
    'multiple' => 'checkbox',
    'label' => 'Text Label',
    'value' => $alreadyinvites,
    'class' => 'selbox'));
    $selected = array(2, 3);
    $options = array(1, 2, 3, 4);

echo $this->Form->input('Attendees', array('multiple' => true, 'options' => $options, 'selected' => $selected));