需要使用 Zend_Form_Element_Checkbox 的复选框数组 [英] Requires a check box array using Zend_Form_Element_Checkbox

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

问题描述

我需要一个如下所示的复选框数组:

I need an array of check-box that should look like as following:

<input type="checkbox" name="myname[]" >

目前我正在使用

new Zend_Form_Element_Checkbox('myname[]');

但它没有在 html 控件中显示数组.它把它画成

but it doesn't show the array in html control. It draw this as

<input type="checkbox" name="myname">

有什么解决方案吗?

推荐答案

<?php
$myname = new Zend_Form_Element_Checkbox('myname');
$myname->setLabel('This is my label')
       ->setRequired(true)
       ->addMultiOptions(array('myname' => true));

这篇关于需要使用 Zend_Form_Element_Checkbox 的复选框数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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