in reply to Strategy to name/process many similar form fields with cgi.pm?
<form ...> <table> <tr> <td><b>Username 1</b></td> <td><input type=text name="users:0.username"></td> </tr> <tr> <td><b>Email</b></td> <td><input type=text name="users:0.email"></td> </tr> <tr> <td><b>Name</b></td> <td><input type=text name="users:0.name"></td> </tr> </table> <table> <tr> <td><b>Username 1</b></td> <td><input type=text name="users:1.username"></td> </tr> <tr> <td><b>Email</b></td> <td><input type=text name="users:1.email"></td> </tr> <tr> <td><b>Name</b></td> <td><input type=text name="users:1.name"></td> </tr> </table> </form>
use CGI; use Data::URIEncode qw(query_to_complex); use Data::Dumper qw(Dumper); my $q = CGI->new; my $data = query_to_complex($q); print "Content-type: text/plain\n\n"; print Dumper $data; __END__ Will have printed something similar to: $VAR1 = { users => [{ username => "...", email => "...", name => "...", },{ username => "...", email => "...", name => "...", }], };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Strategy to name/process many similar form fields with cgi.pm?
by punch_card_don (Curate) on Apr 06, 2007 at 00:35 UTC |