Kosko
11-09-2004, 06:10 AM
I've installed and run perl, cgi, and an
localhost web server onto my homecomputer. I've run simple
scripts on each kind to make sure they work, and they were
going fine. I tried incorporating a form with cgi and got a
problem though. The form calls the cgi script correctly and
the cgi will display the correct text back in the browser. A
problem comes when I try to set the perl variable equal to
the value passed in by the form. When I comment that line
out, the script will work, when I put the line in, the script
stops working. I've checked the names between the two pieces
of code about a million times. I was wondering if you could
see anything that I'm missing. Any help would be great,
thanks.
This is the HTML(saved as testcgi.html):
<FORM ACTION="http://localhost/cgi-bin/perltest.cgi"
METHOD=POST>
Test Data: <INPUT TYPE="checkbox" NAME="value" VALUE="BAH">
Test Data: <INPUT TYPE="text" NAME="data" VALUE="BAH">
<INPUT TYPE="submit" VALUE="Input">
<INPUT TYPE="reset" VALUE="Reset">
This is the perl(saved as perltest.cgi):
#!/usr/local/bin/perl -wT
use strict;
use CGI ':standard:';
my $test; #i can leave this line in and it still works
#$test=param('value'); #this is the problem line
#i've also tried making it a double =,didn't make a difference
print "Content-type: text/html\n\n";
print "The server works $test";
</FORM>
localhost web server onto my homecomputer. I've run simple
scripts on each kind to make sure they work, and they were
going fine. I tried incorporating a form with cgi and got a
problem though. The form calls the cgi script correctly and
the cgi will display the correct text back in the browser. A
problem comes when I try to set the perl variable equal to
the value passed in by the form. When I comment that line
out, the script will work, when I put the line in, the script
stops working. I've checked the names between the two pieces
of code about a million times. I was wondering if you could
see anything that I'm missing. Any help would be great,
thanks.
This is the HTML(saved as testcgi.html):
<FORM ACTION="http://localhost/cgi-bin/perltest.cgi"
METHOD=POST>
Test Data: <INPUT TYPE="checkbox" NAME="value" VALUE="BAH">
Test Data: <INPUT TYPE="text" NAME="data" VALUE="BAH">
<INPUT TYPE="submit" VALUE="Input">
<INPUT TYPE="reset" VALUE="Reset">
This is the perl(saved as perltest.cgi):
#!/usr/local/bin/perl -wT
use strict;
use CGI ':standard:';
my $test; #i can leave this line in and it still works
#$test=param('value'); #this is the problem line
#i've also tried making it a double =,didn't make a difference
print "Content-type: text/html\n\n";
print "The server works $test";
</FORM>