| Re: [PHP] Unknown number of check boxes? -
06-02-2007, 08:55 PM
Søren Neigaard wrote:
> Hi
>
> I would like to have a unknown number of generated check boxes like this:
>
> <input type="checkbox" name="chk01" />
> <input type="checkbox" name="chk02" />
> <input type="checkbox" name="chk0X" />
<input type="checkbox" name="chk[]" value="Check box One" />
<input type="checkbox" name="chk[]" value="Check box Two" />
<input type="checkbox" name="chk[]" value="Check box Three" />
Then one the processor page, have it grab the "array" of indexed results
being submitted.
if ( isset( $_REQUEST['chk']) &&
is_array( $_REQUEST['chk']) &&
count( $_REQUEST['chk']) > 0 ) {
foreach ( $_REQUEST['chk'] AS $index => $value ) {
//Do something here with the checkboxes submitted
}
}
>
> And the name will be generated "chk01 to chk99", but how do I make the
> receiving PHP script that "scans" for post variables that are sent, so
> that I can work on this information?
>
> Best regards
> Søren |