Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Creating multiple textfields with for loops and capturing its values with CGI.pm

by Samy_rio (Vicar)
on Jun 15, 2006 at 04:08 UTC ( [id://555421]=note: print w/replies, xml ) Need Help??


in reply to Creating multiple textfields with for loops and capturing its values with CGI.pm

Hi monkfan, Get the User input and do as below:

#!C:\perl\bin\perl use strict; use diagnostics; use Data::Dumper; use CGI qw/:standard :html3/; use CGI::Carp qw( fatalsToBrowser ); my $nbr_of_fields = 15; # This is taken as user input print header("text/html"); print start_html(); print start_form({-method=>"post", -action=>"test.cgi"}),br; for (0..$nbr_of_fields - 1) { print textfield(-name=>"field_name$_", -value=>5, -size=>50, -maxlength=>80); } print hidden({-name=>"User_Input", -value=>"$nbr_of_fields"}); print submit({-name=>'action', -value => 'Submit' }), end_form, end_html;

Fetch the Fields value as follow:

Test.cgi -------- #!C:\perl\bin\perl use strict; use diagnostics; use Data::Dumper; use CGI qw/:standard :html3/; use CGI::Carp qw( fatalsToBrowser ); my $user_input = param('User_Input'); print header("text/html"); print start_html(); for (0..$user_input - 1) { print "Filed_name$_ :   ", param("field_name$_") +,br; } print end_html;

I think this will help you.

Regards,
Velusamy R.


eval"print uc\"\\c$_\""for split'','j)@,/6%@0%2,`e@3!-9v2)/@|6%,53!-9@2~j';

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://555421]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2024-04-20 03:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found