1

我正在使用 cakephp 2.2.0,因为我正在显示多选复选框,一切正常,除了它在每个复选框的字段集中显示数字。我想删除它,我该怎么办?下面是我在 ctp 文件中的复选框代码。

echo $this->Form->input('Student.sub_id', array(    
                                                        'type' => 'select',
                                                        'multiple' => 'checkbox',
                                                        'options' => $sub
                                                    )); 

Student.sub_id 中,sub_id (varchar)是我的学生表字段。

在此代码中显示复选框,例如:复选框

'options' => $sub 当我打印数组$sub (print_r) 时,它会显示如下内容:

Array
(
    [0] => Array
        (
            [3] => Maths
        )

    [1] => Array
        (
            [4] => Science
        )

    [2] => Array
        (
            [5] => PHP
        )

    [3] => Array
        (
            [6] => Java
        )

    [4] => Array
        (
            [7] => C++
        )

)

那么,我应该怎么做才能删除数字?

4

1 回答 1

0

假设您正在为学生使用 ->find('list'),请删除 .subid

echo $this->Form->input('Student', array(    
                                        'type' => 'select',
                                        'multiple' => 'checkbox',
                                         'options' => $sub
                                        )); 
于 2013-05-24T08:49:59.513 回答