punch_card_don has asked for the wisdom of the Perl Monks concerning the following question:
Imagine you have a user sign-up form in html. Name, address, etc.
But now you want to have a single form with input fields for 50 users at a time. 50 name fields , 50 address fields, etc. You'll be dynamically generating the form from a Perl script and TK.
You'll be processing the form with cgi.pm to store it all in a db.
What's a good strategy for setting up the form names that cgi.pm can most effectively exploit?
For example, you could name all the Name fields "name_x", where x is indexed from 1 to 50, and then for processing do something like:
$query = new CGI; @form_field_names = $query->param; foreach $field_num_pair (@form_field_names) { ($field, $index) = split(/_/, $field_num_pair); $form_values{$index}{$field} = $query->param($field_num_pair); }
Thanks.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Strategy to name/process many similar form fields with cgi.pm?
by Rhandom (Curate) on Apr 06, 2007 at 00:04 UTC | |
by punch_card_don (Curate) on Apr 06, 2007 at 00:35 UTC | |
|
Re: Strategy to name/process many similar form fields with cgi.pm?
by philcrow (Priest) on Apr 05, 2007 at 20:20 UTC | |
|
Re: Strategy to name/process many similar form fields with cgi.pm?
by ruoso (Curate) on Apr 06, 2007 at 11:06 UTC | |
|
Re: Strategy to name/process many similar form fields with cgi.pm?
by Anonymous Monk on Apr 06, 2007 at 20:17 UTC | |
|
Re: Strategy to name/process many similar form fields with cgi.pm?
by Brovnik (Hermit) on Apr 11, 2007 at 11:33 UTC | |
by Corion (Patriarch) on Apr 11, 2007 at 11:41 UTC |