vendredi 21 avril 2017

Post the checkboxes in an array that are unchecked

I want to get all values from a set of checkboxes via POST - also the ones that return false. For a single checkbox there is a solution here. It's hacky but it does at least not require Javascript. But how about this

<input name="link[]" type="checkbox"/>
<input name="link[]" type="checkbox"/>
...

A similiar solution as the one suggested in the other post would not work, because it keeps iterating:

<input name="link[]" type="hidden"/>    <!-- 0 -->
<input name="link[]" type="checkbox"/>  <!-- 1 -->
<input name="link[]" type="hidden"/>    <!-- 2 -->
<input name="link[]" type="checkbox"/>  <!-- 3 -->
...




Aucun commentaire:

Enregistrer un commentaire