Page 1 of 1

checkbox question

Posted: Wed Aug 10, 2005 8:16 pm
by thegreatone2176
Basiclly my code works by imploding then exploding $_POST and its working fine except that since I do it in this manner if a value is left blank i still need it to fill a spot in the array. The textboxes do this fine but not the checkboxes. so basiclly is there a way to make a checkbox post a null or blank value so that it can take up an element of an array.

Posted: Wed Aug 10, 2005 8:41 pm
by timvw
I don't understand what you are doing, but with the code below you get an empty answer..

Code: Select all

<form method="post" action="">
<input type="hidden" name="answer[]" value="">
<input type="checkbox" name="answer[]" value="1"/>
<input type="checkbox" name="answer[]" value="2"/>
<input type="checkbox" name="answer[]" value="3"/>
<input type="checkbox" name="answer[]" value="4"/>
<input type="submit"/>
</form>

Posted: Wed Aug 10, 2005 9:08 pm
by thegreatone2176
thanks dude thats just what i needed