RE: [PHP] Passing marked rows in a table

From: Date: Tue, 02 Nov 2004 23:23:07 +0000
Subject: RE: [PHP] Passing marked rows in a table
Groups: php.general 
Request: Send a blank email to php-general+get-200973@lists.php.net to get a copy of this message
[snip] Pablo Gosse wrote: > [snip] > If the elements all live within the same form, you can add [] to the > end of the name/id attribute, and then all checkboxes with the > same name will be accessible in an array. So "checkboxname[]" will > show up as $_POST['checkboxname'] on the receiving end. [/snip] Todd Cary wrote: > Can I do $MyArray = $_POST['checkboxname']; > > And then access each array element > for ($i = 0; $i < (count($MyAray)); $i++) echo $MyArray[$i]; > > Todd [/snip] Yes, that should work fine. But remember the caveat that all elements using the [] notation must be in the same form. If you've got multiple forms on the page and expect to get all checkboxname values it will not happen using []. You'll need to use JS for that. Pablo.

« previous php.general (#200973) next »