RE: [PHP] array of checkbox values

From: Date: Wed, 11 Jan 2006 20:05:55 +0000
Subject: RE: [PHP] array of checkbox values
Groups: php.general 
Request: Send a blank email to php-general+get-228491@lists.php.net to get a copy of this message
> Hallo, > I have a form with a number of checkboxes grouped together. > The value of > these boxes is stored in an array: $used[]. Now I found that > the value of > checked boxes (value = 'Y') are stored in the array while non > checked boxes > are not stored at all. This makes the array incomplete as I > want to have all > checkbox values in the array. > For example: for 4 checkboxes the values are > checkbox 1: array index = 0 value = "Y" > checkbox 2: array index = 1 value = "Y" > checkbox 3: value = "N" : it does not occur in the array > checkbox 4: array index = 2 value = "Y" > > Is there a way to, as it were, complete the array and have all values > stored, even the "N" values? So that array index 2 has a > value of "N", and > array index 3 is "Y". You could pre-initialize the array with all 'N' values, then update the array with the 'Y's from the checkboxes. JM

« previous php.general (#228491) next »