I have a group of checkboxes in a from and I need to get values with php. Note that div class="group" can also be duplicated onruntime (with jquery) so I may end with multiple div class="group" of checkboxes.
Is there a way to set checkboxes name so form data gets grouped together for each "group", or whatever is easier to handles afterwards? There is also a problem of checkboxes that were not checked, so they wont be present in a post data.
I tried using names like this but I dont like the results.
<form>
<div class="group">
<input type="checkbox" name="ev[][time]">
<input type="checkbox" name="ev[][space]">
<input type="checkbox" name="ev[][money]">
</div>
<div class="group">
<input type="checkbox" name="ev[][time]">
<input type="checkbox" name="ev[][space]">
<input type="checkbox" name="ev[][money]">
</div>
</form>
ev[time][]could be better could be worse, no way to know currentlyev[0][time],ev[1][time]etc should be used, because a un-ticked checkbox's "empty" or "false" state will not be sent, messing up your array indexing. Basically userow[0][key]notation for simplest groupingev1... for the first group andev2... for the second group.ev[0][time]+ev[1][time]and notev[0][time]+ev[2][time]when using the[]notation with checkbox fields. Much safer to be verbose with field names when grouping.