Re: dynamic checkboxes submit..help!
| From: | Nicole Amashta | Date: | Mon, 18 Feb 2002 15:20:24 +0000 |
| Subject: | Re: dynamic checkboxes submit..help! | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-12128@lists.php.net to get a copy of this message | ||
OK, name all the related check boxes with the same name and put [] at the
end of the name so it looks like an array.
Then, in your phpscript, you can access all the values in the area.
example:
In your HTML page:
<input type="checkbox" name="ids[]" value=1>
<input type="checkbox" name="ids[]" value=2>
<input type="checkbox" name="ids[]" value=3>
<input type="checkbox" name="ids[]" value=4>
<input type="checkbox" name="ids[]" value=5>
in your php script, access the ids like so:
$ids
you can loop through the $ids array to verify WHAT values were actually
checked on the form.
for($i=0; $i<$ids; $i++)
{
if ( isset($ids[$i]) )
// do something
}
Hop this helps ya!
Nicole Amashta
www.aeontrek.com
====================
"Sandeep Murphy" <Sandeep.Murphy@oni.pt> wrote in message
news:69E9C8885D77554CAF2A7C5C690F43595B6290@arexcprd01.e3g.pt...
> Hi,
>
> I have a dynamically generated tree of checkboxes which I need to submit
to
> a PHP page for performing a search..
>
> Can anyone pl suggest as to how I can submit the values of all the
> checkboxes which are checked??
>
> TIA,
>
> sands