Below is a script that uses CGI.pm to generate HTML code. If the query var 'checks' is NOT present, a form of 5 text boxes (each named 'checks') is printed out with submit button. When the user fills out ALL boxes (i did not include any validation code), the form is submitted and those names are used to dynamically create a checkbox group. The -linebreak option in CGI's checkbox_group() method prints the checkboxes vertically, instead of horizontally.
use strict; use CGI qw(:standard); print header, start_html, start_form; if (my @checks = param('checks')) { print checkbox_group( -name => 'myName', -values => \@checks, -linebreak => 1 ); } else { print textfield('checks'), "<br>" for (0..4); print submit; } print end_form, end_html;
Hope this helps,
jeffa
In reply to (jeffa) Re: Dynamic CheckBoxes
by jeffa
in thread Dynamic CheckBoxes
by bluecafe
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |