ecuguru has asked for the wisdom of the Perl Monks concerning the following question:
if ($ENV{'REQUEST_METHOD'} eq 'GET') { @pairs = split(/&/, $ENV{'QUERY_STRING'}); } elsif ($ENV{'REQUEST_METHOD'} eq 'POST') { read (STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); @pairs = split(/&/, $buffer); } else { print "Content-type: text/html\n\n"; print "<P>Use Post or Get"; } foreach $pair (@pairs) { ($key, $value) = split (/=/, $pair); $key =~ tr/+/ /; $key =~ s/%([a-fA-F0-9] [a-fA-F0-9])/pack("C", hex($1))/eg; $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9] [a-fA-F0-9])/pack("C", hex($1))/eg; $value =~s/<!--(.|\n)*-->//g; if ($formdata{$key}) { $formdata{$key} .= ", $value"; } else { $formdata{$key} = $value; } } $id = $formdata{'id'}; $num = $formdata{'num'}; #If there great, if not how do i know? $num = sprintf("%3.3f",$num); #if num is not present, this makes num +0.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Is $formdata present?
by blazar (Canon) on Jun 07, 2005 at 08:46 UTC | |
Re: Is $formdata present?
by stonecolddevin (Parson) on Jun 07, 2005 at 09:59 UTC | |
Re: Is $formdata present?
by tchatzi (Acolyte) on Jun 07, 2005 at 08:49 UTC | |
by Anonymous Monk on Jun 07, 2005 at 09:03 UTC | |
by techcode (Hermit) on Jun 07, 2005 at 22:05 UTC | |
by ruoso (Curate) on Jun 07, 2005 at 18:33 UTC | |
by ecuguru (Monk) on Jun 07, 2005 at 17:45 UTC | |
by Anonymous Monk on Jun 07, 2005 at 09:08 UTC | |
Re: Is $formdata present?
by jpeg (Chaplain) on Jun 07, 2005 at 09:11 UTC | |
by ecuguru (Monk) on Jun 07, 2005 at 17:40 UTC |