i have a foreach loop in my zend form, in this case the $this->args[1]
has a count of 5 :
foreach ($this->args[1] as $val)
{
$submitImage = new Zend_Form_Element_Image('submit_image');
$checkBox = new Zend_Form_Element_Checkbox('id_checkbox');
$this->addElement( $submitImage ->setImage($val->full_path) );
$this->addElement( $checkBox ->setValue($val->id) );
}
the problem i encounter is that the $submitImage
and $checkBox
get overwritten and i only get one element of each, the last one.
any ideas how to make them all show up?
thanks
i've also tried:
$i=0;
foreach ($this->args[1] as $val)
{
$submitImage = 'submitImage'.$i;
$checkBox = 'checkBox'.$i;
$submitImage = new Zend_Form_Element_Image('submit_image');
$checkBox = new Zend_Form_Element_Checkbox('id_checkbox');
$this->addElement( $submitImage ->setImage($val->full_path) );
$this->addElement( $checkBox ->setValue($val->id) );
$i++;
}
but it doesn't work