20
the principle is ok. I have just to add an increment to build a different name for the each checkbox .
The code :
le="color: #000000"><?php $element_tray = new XoopsFormElementTray('Options'); $reqoption = "select title from ".$xoopsDB->prefix("ann_options")." where pid=$fam_annonce order by title"; $result5 = $xoopsDB->query($reqoption); while ($result_array = $xoopsDB->fetchArray($result5)) { echo $result_array['title']." -- "; $ener = new XoopsFormCheckBox ($result_array['title'], 'checkbox[]'); $ener->addOption(); $element_tray->addElement($ener); unset($ener); } $form->addElement($element_tray); $form->display();
The source result :
le="color: #000000"><?php <td class='head'>Options</td> <td class='even'> tata <input type='checkbox' name='checkbox[]' value='' /> tbtb <input type='checkbox' name='checkbox[]' value='' /> tctc <input type='checkbox' name='checkbox[]' value='' />
when I use your
le="color: #000000"><?php $ener->addOption(1, _YES);
I have for example
tata [x]oui
(oui is the tranlation of _YES in my language)