This is usefull for displaying x records from a database at a time with a checkbox option next to each record used to mark the records for deletion, updates, etc...
On the page with the checkboxes assign each checkbox name with an incremented value(RECORD1, RECORD2,...) and assign the values from an array:
for($i=0;$i<=$rec_count-1;$i++)
{
$recordname="RECORD"."$i";
print("<br><input type=\"checkbox\" name=\"$recordname\" value=\"$id[$i]\">\n");
}
You must also pass a variable containing the number of checkbox fields you displayed.
<input type="hidden" name="numrecs" value="$numrecs">
Post the form data to a receiving script that extracts the values of the variables you created for each checkbox and puts them into an array as follows...
for($j=1;$j<=$numrecs;$j++)
{
$checkbox_id=${"RECORD".$j};
if($checkbox_id)
{
$new_array[]=$checkbox_id;
}
}
Now you have an array of the values of the checkboxes that were selected.