php - How to read values from MultiCheckbox in Zend -


I have a problem with this Zend form element, how can I read the element status of the multicachebox?

  $ type = new Zend_Form_Element_MultiCheckbox ('typer'); $ Type- & gt; SetLabel ('type'); $ Type- & gt; AddMultiopts (array ('1' => 1 type ',' 2 '=> 2'););  

Thanks for the support!

retrieve it with GetValue ()

  $ Type- & gt; GetValue ();  

This would be an array with only that element that was checked.

i.e.

  & lt; Input type = "checkbox" name = "type []" id = "campaign_id" value = "1" /> & Lt; Input type = "checkbox" name = "type []" id = "campaign_id" value = "2" />  

Such an array will return (if both are checked)

  Array ([0] => 1 [1] = 2)  

If asked only the checkbox 2 was checked then the array

  Aare ([0] => 2)  

getValue () will return NULL if no checkboxes are checked


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -