Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. $form->add(
  2. 'Multiple Checkboxes',
  3. 'multicheck',
  4. FORM_INPUT_TYPE_CHECKBOX,
  5. false);
  6. $form->setValueType(FORM_VALUE_TYPE_ARRAY);
  7.  
  8. $form->addValue(
  9. 1, 'First');
  10. $form->addValue(
  11. 2, 'Second');
  12. $form->addValue(
  13. 3, 'Third');
  14. $form->addValue(
  15. 4, 'Forth');
  16.  
  17. // and once form has been submitted you can check by
  18. $checkedvalues = $form->get('multicheck');
  19.  
  20. // var_dump($checkedvalues); should give you an array of the checked items
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement