Hi all,
 
I'm running:
 
'http://localhost/html/inputForm.html' which takes a first name and last name, 
and submits them to 'http://localhost/cgi-bin/query_string.cgi
 
I get a the following error:
 
-----------------------------snip-1---------------------------
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to 
complete your request.
Please contact the server administrator, [EMAIL PROTECTED] and inform them of 
the time the error occurred, and anything you might have done that may have 
caused the error.
More information about this error may be available in the server error log.
Apache/2.0.52 (Win32) PHP/4.3.10 mod_perl/1.99_18 Perl/v5.8.6 Server at 
localhost Port 80
-----------------------------snip-1---------------------------
 
The form settings are the following:
 
<form name="form1" id="form1" method="get" action="query_string.cgi">
The values of the URL are:
http://localhost/html/query_string.cgi?fname=Ron&lname=Smith&submit=Submit
I did some moving of the files to get this to work but the '.cgi' file prints 
the underlying code from the above location. And, if I put both pages in the 
'cgi-bin' directory, the ".html" page throws the following browser error;
 
-----------------------------snip-2---------------------------
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to 
complete your request.
Please contact the server administrator, [EMAIL PROTECTED] and inform them of 
the time the error occurred, and anything you might have done that may have 
caused the error.
More information about this error may be available in the server error log.
Apache/2.0.52 (Win32) PHP/4.3.10 mod_perl/1.99_18 Perl/v5.8.6 Server at 
localhost Port 80
-----------------------------snip-2---------------------------
 
Following is the code to the CGI script:
 
#!/wwww/perl/bin/perl.exe -wT
# input will be coming from "inputForm.html"
use strict;
use CGI qw(cgi);
use CGI::Carp qw(fatalsToBrowser);
print "content-type: text/html\n\n";
my %form;
my @pairs = split(/&/, $ENV{'QUERY_STRING'});
foreach (@pairs) {
 my ($name, $value) = split(/=/, $_);
 $value =~ tr/+/ /;
 $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
 $form{$name} = $value;
}
print <<HTML;
<html>
 <head><title> Output Form </title></head>
 <body>
  <center><h3> Form Output </h3></center><p></p>
HTML
foreach (keys %form) {
 print "$_ = %form{$_}<br>";
}
print <<HTML;
 </body>
</html>
HTML
 
Does anyone have any advice as to how to get this script to accept values from 
a ".html" page. It's probably something I'm unaware of. I'm just starting to 
get into CGI scripts.
I've since found a script that delivers what I want:
-----------------------------snip-3---------------------------
#!/www/perl/bin/perl.exe -wT
use strict;
use CGI qw(:standard);
use CGI::Carp qw(fatalsToBrowser);
my $first_name = param('fname');
my $last_name = param('lname');
print header,
 start_html('Form Output'),
 h3({-align=>'center'}, 'Form Output'),
 p;
 print $_ . " - ". param($_) . br foreach param;
 print end_html;
-----------------------------snip-3---------------------------
 
TIA

Ron

Reply via email to