Re: Quick way to test series of integers

From: Date: Thu, 24 Oct 2002 22:55:28 +0000
Subject: Re: Quick way to test series of integers
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-121362@lists.php.net to get a copy of this message
If they're the only input in the form, you could do something like: foreach($_GET as $key=>$value){ if(!array_key_exists($key,$_GET)){ $_GET[$key] = 0; } } //Subsitute $_POST for $_GET if it's a post form. Paul Kaiser wrote:
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. HOWEVER... 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?? Thanks, Paul
-- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.

« previous php.general (#121362) next »