Here's my problem: I got 11 checkbox on my website for a form creating accounts. When I submit the form (which is POST on the same page) I verify that mandatory input are there. In the case one is missing (ex. the password), I want to keep information that has been entered before INCLUDING checkbox. My problem is: How?
Here's my checkbox:
<table class="adroite">
<tr><td>NES<input type="checkbox" name="chkcons[]" value="NES"/></td>
<td>SNES<input type="checkbox" name="chkcons[]" value="SNES"/></td>
<td>N64<input type="checkbox" name="chkcons[]" value="N64"/></td>
</tr>
<tr>
<td>NGC<input type="checkbox" name="chkcons[]" value="NGC"/></td>
<td>Wii <input type="checkbox" name="chkcons[]" value="Wii"/></td>
<td>WiiU <input type="checkbox" name="chkcons[]" value="WiiU"/> </td>
</tr>
<tr>
<td>GB <input type="checkbox" name="chkcons[]" value="GB"/></td>
<td>GBC <input type="checkbox" name="chkcons[]" value="GBC"/></td>
<td>GBA <input type="checkbox" name="chkcons[]" value="GBA"/></td>
</tr>
<tr>
<td>DS <input type="checkbox" name="chkcons[]" value="DS"/></td>
<td>3DS <input type="checkbox" name="chkcons[]" value="3DS"/></td>
</tr>
</table>
You see that checkbox are name chkcons[]. I use this method to save the results in MYSQL after the checkup.
So, how can I tell my PHP: See, this checkbox was checked, so keep it check after submit? Thanks!
selected="selected"
attribute to the checkboxes as appropriate. – Marc B