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" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> 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" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > 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
>
>



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

Reply via email to