RE: [PHP] determine how many checkboxes are selected.
| From: | Ralph Guzman | Date: | Tue, 26 Aug 2003 07:14:12 +0000 |
| Subject: | RE: [PHP] determine how many checkboxes are selected. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-160732@lists.php.net to get a copy of this message | ||
Change box names to chk[] and assign the id as the value, so for
example:
<INPUT TYPE="checkbox" NAME="chk[]" VALUE="56">
to check which boxes have been checked simply traverse through the chk[]
array like this:
$chk_array = $_POST['chk'];
for($chk_array as $chk_key => $chk_value)
{
print 'Checkbox Id:'. $chk_key . ' Value:'. $chk_value .'is
checked';
}
I have not tested this, but it should work.
-----Original Message-----
From: Angelo Zanetti [mailto:binc2@ctech.ac.za]
Sent: Monday, August 25, 2003 10:07 PM
To: Php-General@Lists.Php.Net
Subject: [PHP] determine how many checkboxes are selected.
Hi I have a tabel that gets populated dynamically from a DB query. Each
row
is a seperate record and they all have a checkbox. I want to put a
button/image @ after the table and when it is click ed to determine
which
checkboxes have beeen selected. I also name the checkboxes dynamically
with
chk being the prefix and the record ID the suffix eg record 56: chk56
would
be the name of that particular checkbox.
If anyone could help with this design issue I would appreciate it!
Or any advice will be great as well.
angelo
TIA
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php