蛋糕PHP复选框 [英] Cake PHP Checkboxes

查看:114
本文介绍了蛋糕PHP复选框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新的CakePHP现在我正在工作复选框我使用以下语句,但它
给标签后的复选框,它打印字段also.My要求是不
print应在复选框后显示字段名称和标签。
请帮助我,
提前感谢

I am new to CakePHP now I'm working on checkbox I used the following statement but it gives check box after the label and it prints the field also.My requirement is it does not print the field name and label should be displayed after the check box. please help me , Thanks in advance

<?php echo $form->input('Model.name', array('multiple' => 'checkbox', 'options' => 
$options, 'selected' => $selected));?>


推荐答案

首先, boolean或tinyint 。

First, make sure your value is a boolean or tinyint. Otherwise, you will never get a checkbox.

然后,只需构建如下:

echo $this->Form->input('Model.field', array(
    'type' => 'select',
    'multiple' => 'checkbox',
    'options' => array(
            'Value 1' => 'Label 1',
            'Value 2' => 'Label 2'
    )
));

这篇关于蛋糕PHP复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆