Requires a check box array using Zend_Form_Element

2019-06-26 17:46发布

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条回答
戒情不戒烟
2楼-- · 2019-06-26 18:37
<?php
$myname = new Zend_Form_Element_Checkbox('myname');
$myname->setLabel('This is my label')
       ->setRequired(true)
       ->addMultiOptions(array('myname' => true));
查看更多
登录 后发表回答