Re: dynamic checkboxes submit..help!
| From: | Nicole Amashta | Date: | Mon, 18 Feb 2002 15:24:46 +0000 |
| Subject: | Re: dynamic checkboxes submit..help! | ||
| References: | 1 2 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-12129@lists.php.net to get a copy of this message | ||
Always some little bug to slip in ....
I forgot to do a count on the array to get the size:
Here is my code corrected:
$size = count($ids);
for($i=0; $i<$size; $i++)
{
if ( isset($ids[$i]) )
// do something
}
"Nicole Amashta" <430ntr3k@bellsouth.net> wrote in message
news:20020218151938.1277.qmail@pb1.pair.com...
> 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...µÌXÉŽñ
> ¦
ÇÚ²U
> > 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
>
>