aurora26 has asked for the wisdom of the Perl Monks concerning the following question:

I created two tables in cgi and those table contains some text feilds to enter values. After pressing "submit" button i want to read all those values entered in the table.... Please somebody help me to resolve this issue...
  • Comment on how to get table data in cgi after submitting the form?

Replies are listed 'Best First'.
Re: how to get table data in cgi after submitting the form?
by marto (Cardinal) on Apr 04, 2012 at 10:22 UTC
Re: how to get table data in cgi after submitting the form?
by thomas895 (Deacon) on Apr 04, 2012 at 13:19 UTC

    In your form CGI:

    print $cgi->textfield( -name => "foo", #This is the name we need later -value => "bar" );

    In your code where you want to retrieve those values:

    my $foo = $cgi->param( -name => "foo" #Back from earlier );

    Couldn't get easier than that :)

    ~Thomas~
      Don't know what you're initializing CGI.pm with (I always use CGI qw(:standard) ), but in my scripts I can access the form fields just by saying param('foo'), or if I want to cycle through them, param($_) for param() . Your method seems a bit wordy.
        Your method seems a bit wordy.

        I do it for verbosity, so that the OP gets exactly what I mean. You're right -- I could have done it using the :standard method, but I personally dislike that method.
        My initialisation of the CGI object is just $cgi = new CGI;

        ~Thomas~