Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

mdxi (4658)

mdxi
  (email not shown publicly)
http://mdxi.collapsar.net/

Journal of mdxi (4658)

Saturday May 08, 2004
12:44 AM

Today's Lesson #1

[ #18675 ]

You cannot do this:

<form action='script.cgi?a=foo&b=bar'>

The "params" won't actually be retrievable as params by param(). Split them out into hidden INPUTs.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Is the problem on the server-side? Why not just fix your
    server software, instead of futzing with your HTML?
  • CGI.pm unfortunately seems to think a POST request should have no query string or that (if you uncomment a line in CGI.pm) POST data and the query string should be thrown together.

    I hate this behaviour and for PLP chose to put query string fields in %get, posted fields in %post and have %fields there in case you want to get from either. Note that the interface is a hash. That seemed appropriate for key/value pairs.

    I dislike CGI.pm
  • You want
    <form action='script.cgi?a=foo&amp;b=bar'>
    if that's part of an HTML file. You forgot to HTML-entitize the ampersand.
    --
    • Randal L. Schwartz
    • Stonehenge
  • If you're using CGI::Simple [cpan.org] then it's just a matter of:
      $q = new CGI::Simple;
      $q->parse_query_string;  # add $ENV{'QUERY_STRING'} data to our $q object
    CGI is dead, long live CGI::Simple! :)
    • Well, the most significant user difference between CGI.pm and CGI::Simple for me would be the lack of sticky form fields. And I use sticky form fields quite a bit, so CGI::Simple doesn't meet my needs.
      --
      • Randal L. Schwartz
      • Stonehenge
      • I don't like to mess with HTML, I'd rather it stay out of my program and into a template. Using HTML::FillInForm/Template::Plugin::FillInForm is a lot nicer.
  • If you poke around CGI.pm, you find this comment:
    # Uncomment this line to have the contents of the query string
    # APPENDED to the POST data.
    Just uncomment the following line and get your params the way you should.