Article 14613 of comp.infosystems.www:
Xref: feenix.metronet.com comp.infosystems.www:14613
Path: feenix.metronet.com!news.utdallas.edu!wupost!gumby!newsxfer.itd.umich.edu!jobone!lynx.unm.edu!mimbres.cs.unm.edu!bbx!tantalum!edsr!tad!news
From: [email protected] (Sean Dowd)
Newsgroups: comp.infosystems.www
Subject: Re: Forms (POST) and PERL
Message-ID: <[email protected]>
Date: 29 Apr 94 14:16:04 GMT
References: <[email protected]> <[email protected]>
Sender: [email protected]
Reply-To: [email protected]
Organization: EDS Technology Architecture, Plano, TX
Lines: 37
In-Reply-To: [email protected]'s message of 29 Apr 94 00:01:38 GMT
Nntp-Posting-Host: calvin

This is the one I use:

#!/usr/local/bin/perl

# also uses shellparse to get the query parms in a readable format.

sub parse_query {
       local($lqs) = @_;
       (@localparms) = split(/&/,$lqs);
       $nparms = scalar(@localparms);
       foreach $p (@localparms) {
               ($pname,$pvalue) = split(/=/, $p);
               $pvalue =~ s/\+/ /g;
               $pvalue =~ s/%([0-9a-fA-F][0-9a-fA-F])/sprintf("%c",hex($1))/eg;
               $parms{$pname} = $pvalue;
       }
}

do parse_query ($qs = $ENV{'QUERY_STRING'});

print "<b>Here are your answers: </b><p>";

print "<PRE>";
foreach $key (sort(keys(%parms))) {
       # strip off newlines
       $parms{$key} =~ s/
       $parms{$key} =~ s/\n/ /g;
       $parms{$key} =~ s/\r/ /g;
       print "$key: $parms{$key}\n";
}
print "</PRE>";

--
===========================================================================
Sean S. Dowd  [email protected] ([email protected])
EDS Technology Architecture, Plano, TX
#include <std/disclaim.h>