Re: Dealing with Unchecked Checkboxes
| From: | Micah Stevens | Date: | Sat, 26 Oct 2002 20:15:59 +0000 |
| Subject: | Re: Dealing with Unchecked Checkboxes | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-22713@lists.php.net to get a copy of this message | ||
Unchecked checkboxed do not return a value. They don't return a NULL or empty string or anything. So what you have to do is check to see if the variable is set. If it is set, then it's checked, if it's not set, then it's unchecked.
Kinda sucks if your variable names are dynamic, I just erase the whole record and re-insert in that case.
-Micah
At 09:02 PM 10/26/2002 +0100, Graeme McLaren wrote:
Hey all, I'm trying to get my head around checkboxes. I can insert "checked" checkboxes into a DB no problem but I get an error when the checkboxes are unchecked. I've used the following to try and handle unchecked checkboxes but I still get the error "query was empty" can anyone point me in the right direction? $number=count($GiftWrapping); for($a=0;$a<$number;$a++) {echo $GiftWrapping[$a];if ( empty( $GiftWrapping ) ) { $GW = 'N'; } INSERT INTO DB CODE HERE GiftWrapping = '$GW'"; } Cheers in advance, Graeme :) Public Sub House() On Error Resume drinkIf Pint.empty = True Then Pint.refillElsePint.drink End ifstomach.add Pint MsgBox " I've had .... " & stomach.count & " Pints" MsgBox "VERY DRUNK" End Sub