Cannot access POSTed form data

From: Mark (noonehere_at_fakoaddresso.como)
Date: 07/23/04


Date: Fri, 23 Jul 2004 15:26:53 GMT

I'm no Perl expert so I basically copied this code from a tutorial and I'm
not totally clear how it works. However, I am having trouble accessing the
POST variables that are posted to my page from another form on a different
server.

This is the code I am using to get at the variable:

#!/usr/bin/perl

# orderform.cgi

read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
foreach $pair (@pairs)
{
    ($name, $value) = split(/=/, $pair);
     $value =~ tr/+/ /;
     $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
     $Form{$name} = $value;
}

print <<END_of_multiline_text;
Content-Type: text/html; charset=ISO-8859-1

<...html code here...>

END_of_multiline_text;

Okay, in that HTML section I refer to my variable in the following line:

<p>Your order is worth a total of:
<strong>&pound;$FORM{'grandtotal'}</strong></p>

However, the variable just displays a blank. I've a very rough idea of what
the code is doing but I've seen it posted on several tutorial sites so I
presume it's a pretty standard way of accessing form data. I think there
must be something wrong with how I call the variable in the HTML paragraph.

Thanks
Mark