For Programmers: Free Programming Magazines  


Home > Archive > PERL CGI Beginners > October 2006 > problems reading form data









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author problems reading form data
mdnova

2006-10-30, 6:55 pm

I have a form on an IIS box sending data to be processed, via POST, by
a process.pl on a UNIX box. The directories on the UNIX box and the
process.pl have 777 permissions (wide open since this is a test
environment).

The problem: none of the data seems to be transmitting to the perl
script from the form; the last two variables in the script below keep
coming back empty. Are there some restrictions on STDIN that make my
approach wrong? I did try using, cgi-bin.pl with &ReadParse(*input);
but that didn't work either. Any ideas?


The first part of the process.pl script is this standard processing
script:

read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});

# Split the name-value pairs
@pairs = split(/&/, $buffer);
#print "Pairs: @pairs\n";

foreach $pair (@pairs)
{
($name, $value) = split(/=/, $pair);

# Un-Webify plus signs and %-encoding
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;

$FORM{$name} = $value;
}

$last = $FORM{'CCScript'};
$desc = $FORM{'Description'};

The names within the brackets are the names of the fields on the form.
I have a trap on the form to be sure that at least at the time the data
is sent, the fields on the form are decidely not empty.

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com