Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

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

by kwoff (Friar)
on Nov 06, 2001 at 09:19 UTC ( [id://123512]=note: print w/replies, xml ) Need Help??


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

It looks reasonable so far, so I have a feeling it's not CGI.pm's fault here.. Debugging time. :)

How did you make the radio buttons (CGI.pm or just HTML)? If CGI.pm, are you sure the syntax is correct? What are the names of the radio buttons in the HTML? Do the names match @required? Are the buttons inside of the <FORM> tags? Can you simplify the problem to using maybe one or two fields instead? Insert `print STDERR $field` statements and peek at the log (or use CGI qw(fatalsToBrowser).

Replies are listed 'Best First'.
Re: Re: Does CGI.pm have a limit on information passed?
by c (Hermit) on Nov 06, 2001 at 10:18 UTC
    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

      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://123512]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2024-03-28 14:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found