"Paul Kaiser" <[EMAIL PROTECTED]> wrote in message
> 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...
You can take advantage of the way PHP parses passed values...
If you have two (or more) form inputs with the same name, the last value
over-writes the previous one(s). ie if your script is called like
then you get
$_GET["n"] == 1
Sure, you say, but how can I make use of that?
Well, if the last value weren't sent, you would still have the previous
value, ie $_GET["n"] == 0
<input type=hidden name=n value=0> // this value is *always* sent
<input type=checkbox name=n value=1> // this value is only sent if
NOTE: the order is important! The conditional input must come *after*
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php