Today's Lesson #1

mdxi on 2004-05-08T05:44:01

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.


server-side?

mary.poppins on 2004-05-08T08:26:47

Is the problem on the server-side? Why not just fix your
server software, instead of futzing with your HTML?

Only with CGI.pm

Juerd on 2004-05-08T11:13:33

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

Bad HTML anyway

merlyn on 2004-05-08T12:55:35

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.

Re:Bad HTML anyway

brian_d_foy on 2004-05-09T05:00:49

You don't even need to escape ampersands because CGI.pm will happily use a ; as a pair delimiter. See the docs for -newstyle_urls .

CGI::Simple

gav on 2004-05-08T16:51:44

If you're using CGI::Simple 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! :)

Re:CGI::Simple

merlyn on 2004-05-08T19:33:54

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.

Re:CGI::Simple

gav on 2004-05-08T20:03:23

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.

CGI.pm just need an uncommented line

brian_d_foy on 2004-05-09T04:58:36

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.