问题
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