Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Re: Does CGI.pm have a limit on information passed?

by c (Hermit)
on Nov 06, 2001 at 10:18 UTC ( [id://123521]=note: print w/replies, xml ) Need Help??


in reply to Re: Does CGI.pm have a limit on information passed?
in thread Does CGI.pm have a limit on information passed?

well, debugging time it is. i wanted to take out the @required variable completely. so, i wrote this quick little script

#!/usr/bin/perl -w use strict; use POSIX qw(strftime); delete @ENV{qw(IFS CDPATH ENV BASH_ENV)}; $ENV{'PATH'} = "/usr/bin:/usr/local/bin"; use CGI; $CGI::DISABLE_UPLOADS = 1; $CGI::POST_MAX = 1024; ## grab form input my $query = CGI->new(); my %FORM; ## grab form field and stick values in hash my @formfields = $query->param; for my $field(@formfields) { $FORM{$field} = $query->param($field); } print <<EOF; Content-type: text/html\n\n <html> <head> <title>Missed fields!</title> <body bgcolor=#FFFFFF> EOF for my $i(sort keys %FORM) { print qq|<li>$i : $FORM{$i}<br>\n|; } print <<EOF; </body> </html> EOF

so once again though, i find myself eyeballing the radio buttons. when running this script, it churns out the values of the form's input. however, after selecting a couple of radio buttons, the return is actually null! as though nothing was passed into the hash at all.

the radio buttons are written via regular html rather than through cgi.pm. an example of the radio button in the html is as follows:

<td width="215"> <b> <font face="Arial, Helvetica, sans-serif" size="-1"> Yes <input type="radio" name="16accounts_receivable_pledge" value="yes"> No <input type="radio" name="16accounts_receivable_pledge" value="no"> </font> </b> </td>

would the duplicate naming of the form field be causing problems?

humbly -c

Replies are listed 'Best First'.
(Ovid) Re(3): Does CGI.pm have a limit on information passed?
by Ovid (Cardinal) on Nov 06, 2001 at 10:47 UTC

    Yes, the duplicate naming of fields will break your code as you're grabbing the params in a scalar context which will only return the first value. Here's a quick script that will show everything that is sent via your form (this is untested):

    #!/usr/bin/perl -wT use strict; use CGI qw/:standard/; use Data::Dumper; my %formdata = map { $_, @{[param($_)]} > 1 ? [param($_)] : param($_) +} param(); my $dump = Dumper \%formdata; print header, start_html, pre( $dump ), end_html;

    By the way, I'm glad to see that you've deleted dangerous environment variables and done other things to prevent hacking. Good job!

    Cheers,
    Ovid

    Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (4)
As of 2024-04-19 14:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found