checkbox question

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
thegreatone2176
Forum Contributor
Posts: 102
Joined: Sun Jul 11, 2004 1:27 pm

checkbox question

Post 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.
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post 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>
thegreatone2176
Forum Contributor
Posts: 102
Joined: Sun Jul 11, 2004 1:27 pm

Post by thegreatone2176 »

thanks dude thats just what i needed
Post Reply