Forum Moderators: open
Long time reader, first time poster...
Got a little problem with processing a form (it's through a standard perl/cgi script. Originally from the O'reilly Mouse book I think).
The processing sub seems to work fine for both post and get method in isolated tests, but when I actually try to use it in a page, the "post" method fails to produce any results when "get" works fine.
I suspect this has something to do with some differences between "post" and "get" that I'm not aware of. I have a form that I need to use for uploading a fairly large amount of text, so the "get" exceeds the URL limit.
Anyone have any insights to share? Thanks.
-M
if ($ENV{'QUERY_STRING'}) {
$query = $ENV{'QUERY_STRING'};
} elsif ($ENV{'CONTENT_LENGTH'} > 0) {
read(STDIN,$query,$ENV{'CONTENT_LENGTH'});
} else {
return(0);
}
In both of the cases above (the first is GET the second is POST) the result ends up in $query.
Hope this helps. If not, a bit more info about the problem might help....
My Perl looks a lot like your example, and it seems to work fine in "isolated" tests I set up. Here's my code for the form that's giving me problems:
<form action="check.cgi" enctype="text/plain" METHOD="POST">
<textarea rows=14 cols=40 name="comment"></textarea>
<p>What is your recommendation for this submission?</p>
<input type="radio" name="recommend" value="approve1">Accept with minimal revisions.<br>
<input type="radio" name="recommend" value="approve2">Accept with revisions (please specify above).<br>
<input type="radio" name="recommend" value="approve3">Accept with major revisions (please specify above).<br>
<input type="radio" name="recommend" value="approve4">Reject.
<input type="hidden" name="ID" value="">
<input type="hidden" name="name" value="">
<input type="hidden" name="date" value="Sat Apr 3 11:09:04 2004">
<input type="submit" name="submit" value="submit">
<input type="reset" value="Clear Form">
</form>
Does it have to do with the "enctype-" attribute, maybe?
Thanks for your help.
Give it a try without the enctype specified and see what happens.
Perl works great, but I use PHP, because GET and POST work the same in PHP. You don't have to use two different methods.
In PHP, post and get are still accessed with a dollar sigh prefix.
If you have ASP support, use
Request.QueryString(form variable name) for GET
and
Request.Form(form variable name) for GET