One way you could do it is to put a hidden input before each checkbox with
the same name as the checkbox and set the value to 0.

This works because PHP will process all input fields in order overwriting
previous ones if it comes accross one with the same name..


<input type="hidden" name="one" value="0" />
<input type="checkbox" name="one" value="1" />

<input type="hidden" name="two" value="0" />
<input type="checkbox" name="two" value="1" />

and so on....

Jarrad Kabral

-----Original Message-----
From: Paul Kaiser [mailto:paukai@;]
Sent: Friday, 25 October 2002 7:35 AM
Subject: [PHP] Quick way to test series of integers

Hey there,

I have around 50 checkboxes on an HTML form. Their "value" is "1". So,
when a user check the box, then no problem -- the value returned by the
form is "1" and I can enter that into my SQL database.


If the user does not check the box, I'm in trouble, because the "value"
does not default to "0", but rather <nil> I'm guessing...

mysql query doesn't like my trying to pass NOTHING.

I COULD go through each of the 50 returned variables and, if they are not
"1", assign "0" to them.

But I'm wondering if there is a better way to go about this??


PHP General Mailing List (
To unsubscribe, visit:

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to