I am struggling to use the form below to post and process to my php script. Currently it only brings up those which are selected. I need it to pass the value of 0 where a checkbox isn't selected. I then need my php to iterate through all rows and update by sql.
<form action="update.php" method="post">
<table class="table table-striped">
<tr class="name_5">
<input type="hidden" name="id[]" value="5" />
<td>
iD: 5 Name: Sam
</td>
<td>
<input type="checkbox" name="block1[]" value="1" />
</td>
<td>
<input type="checkbox" name="block2[]" value="1" />
</td>
<td>
<input type="checkbox" name="block3[]" value="1" />
</td>
<td>
<textarea name="notes[]" cols="20" rows="1"></textarea>
</td>
</tr>
<tr class="name_4">
<input type="hidden" name="id[]" value="4" />
<td>
ID: 4 Name: Joanne<br/>
</td>
<td>
<input type="checkbox" name="block1[]" value="1" />
</td>
<td>
<input type="checkbox" name="block2[]" value="1" />
</td>
<td>
<input type="checkbox" name="block3[]" value="1" />
</td>
<td>
<textarea name="notes[]" cols="20" rows="1"></textarea>
</td>
</tr>
<tr class="name_2">
<input type="hidden" name="id[]" value="2" />
<td>
ID: 2 Name: Fiona<br/>
</td>
<td>
<input type="checkbox" name="block1[]" checked value="1" />
</td>
<td>
<input type="checkbox" name="block2[]" checked value="1" />
</td>
<td>
<input type="checkbox" name="block3[]" value="1" />
</td>
<td>
<textarea name="notes[]" cols="20" rows="1"></textarea>
</td>
</tr>
</table>
</form>
I've tried using hidden fields using value of 0 for each row but this didn't work, plus I would rather handle it more elegantly.