Re: checkboxes and loops
| From: | John W. Holmes | Date: | Mon, 29 Mar 2004 11:56:32 +0000 |
| Subject: | Re: checkboxes and loops | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-33681@lists.php.net to get a copy of this message | ||
matthew perry wrote:
<input type = "checkbox" name = "box<?echo $counter;?>" value = "delete"> $counter++;
*********Bad solution 2 (doesn't work)*********** $counter = 1; while (<<whatever>>) { if ($box . $counter == 'delete') <<do whatever>> $counter++; } *******************************************if(${$box . $counter} == 'delete') However, like someone else said, if you named your checkboxes as box[1], box[2], etc, then you'd have a nice $_POST['box'] array that you could loop through. foreach($_POST['box'] as $count => $value) { do_whatever($count); } -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals – www.phparch.com