Hello All,

I've got a form that creates checkboxes based on the number of rows on a table. The 
user has to check some of the boxes and then click submit. The boxes are named RG1, 
RG2, RG3, ....

If there are 4 checkboxes and the user selects them all or selects the first, second 
and fourth, or the first third and fourth my code works. But if the user selects the 
second, third and fourth (He does not checks the first one) no information is recorded 
on my array.

Here's the code that I have to search the $HTTP_POST_VARS and then fill a array 
variable called $RG.


function SearchRGs() {
    global $HTTP_POST_VARS;
    global $RGs;

    // fills the array variable RGs with the values of checked checkboxes that start 
with the name RG# (where # goes from 1,2,3,....).
   // returns the qty of checked RGs and size of the $RGs array.

$index = count($HTTP_POST_VARS);
$count = 0;

for ($i=1; $i < $index; $i++) {
    if (isset($HTTP_POST_VARS["RG$i"])) {
        $RGs[] = $HTTP_POST_VARS["RG$i"];
        $count++;
    }
}

return $count;

}


Can anyone help me with this?

Why if I do not check the first checkbox on the form the array  is not filled.

Thank you,

Carlos Fernando.

Reply via email to