0

I have a variable number (initially 8) checkboxes that all share the same name attribute with different values. However they are separated by many DOM elements.

For example:

<table>
    <tr>
         <td><input type='checkbox' name='site-1-local' value='1' checked></td>
    </tr>
</table>
.
.
.
<table>
    <tr>
         <td><input type='checkbox' name='site-1-local' value='8' checked></td>
    </tr>
</table>

Normally I would expect my php script to aggregate the common name and have something like $_POST['site-1-local'] = array('1', ... '8'). However when I go to assert the values server side using print_r() its only showing 8 (the last value in the DOM with this name) in the $_POST['site-1-local'] array.

I'm guessing that the non-aggregation has something to do with the checkboxes not being side-by-side? However, I haven't been able to find anything on this subject.

asdf
  • 2,927
  • 2
  • 21
  • 42

0 Answers0