Re: checkboxes and loops

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux