Go Back   Forum Care Forums > Development Reference Area > Php Development

Reply
 
LinkBack Thread Tools Display Modes
Re: [PHP] Unknown number of check boxes?
Old
  (#1)
Jim Lucas
Guest
 
Posts: n/a
Default 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

   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Contact Us - Forum Care Forums - Archive - Top