I have done a few SMALL and minor projects with PERL, and this will be my
first time experimenting with CGI.  With a lot of guidance from O'Reilly on
this, I came up with the following script:

#!/usr/local/bin/perl

&parse_form_data (*FORM);

sub parse_form_data
{
local (*FORM) = @_;
local ($query_string, @key_value_pairs, $key_value, $key, $value);

$query_string = $ENV{'QUERY_STRING'};
@key_value_pairs = split (/&/, $query_string);
foreach $key_value (@key_value_pairs) {
($key, $value) = split (/=/, $key_value);
$value =~ tr/+/ /;
$value =~ s/%([\dA-Fa-f][\dA-Fa-f])/pack ("C", hex ($1))/eg;

if (defined($FORM{$key})) {
$FORM{$key} = join ("\0", $FORM{$key}, $value);
} else {
$FORM{$key} = $value;
}
}

# This is where i think the problem is...
$contact = $FORM{'contact'};
$date = $FORM{'date'};
$headline = $FORM{'headline'};
$lead = $FORM{'lead'};
$body = $FORM{'body'};
$topics = $FORM{'topics'};

--<snip>--

The form sends the proper request to the server
(logs say "GET
/cgi-bin/myscript.cgi?contact=Me&date=08212001&headline=blah&lead=blah&body=
hello&topics=news")

For some reason, however, $contact (etc..) aren't being assigned.  Is my
syntax wrong somewhere?

Thanks




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to