Re: Unknown number of check boxes?
| From: | Stephen | Date: | Mon, 28 May 2007 18:51:09 +0000 |
| Subject: | Re: Unknown number of check boxes? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-255716@lists.php.net to get a copy of this message | ||
Søren Neigaard wrote:
I would like to have a unknown number of generated check boxes like this: <input type="checkbox" name="chk01" /> <input type="checkbox" name="chk02" /> <input type="checkbox" name="chk0X" /> And the name will be generated "chk01 to chk99", but how do I make the receiving PHP script that "scans" for post variables that are sent, so that I can work on this information? The form posting agent will only return values for boxes that are checked.You can do isset in a loop up to the maximum possible value. But I suspect that you are generating the form dynamically. If that is the case, add a hidden input with a value of the number of checkboxes. That would be the upper limit of your loop. Stephen