ActiveState Community

Passing variables to PERL CGI

Posted by mralbert on 2008-02-27 06:15
OS: Windows

What is the PERL code that allows a PERL CGI to receive variables
from an HTTP form? I think I have the HTTP code that sends the variable.

I found the below code on the Internet, but they stop my CGI program
from executing:

require "cgi-lib.pl";
&ReadParse(*input);
$input{'myfield'};

Is there a good web page that answers this question?

Thank you,

Mark

MarcZ | Wed, 2008-03-05 07:39

http://www.cgi101.com/learn/

maldrac | Tue, 2008-03-11 20:00

I think you mean form parameters correct me if I'm wrong

#!C:\Perl\bin\perl.exe -w
use strict;
use CGI ':standard';

#Set up some variables
my($input1, $input2, $input3);

#Get param values
my $input1 = param('formInput1'); #Where formInput1 is the name of the form field
my $input2 = param('formInput2');
my $input3 = param('formInput3');

print "$input1";
print "$input2";
print "$input3";

Try these tutorials
http://www.tizag.com/perlT/
http://www.cbkihong.com/download/perltut.pdf
http://www.cgi101.com/book/

Hope that helps