Requires a check box array using Zend_Form_Element_Checkbox

一笑奈何 提交于 2019-12-10 15:16:41

问题


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

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

Currently I am using

new Zend_Form_Element_Checkbox('myname[]');

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

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

AnySolution?


回答1:


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


来源:https://stackoverflow.com/questions/4145198/requires-a-check-box-array-using-zend-form-element-checkbox

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!