Web Servers on Unix and Linux - Apache and CGI-perl

This is Interesting: Free IT Magazines  
Home > Archive > Web Servers on Unix and Linux > May 2004 > Apache and CGI-perl





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 Apache and CGI-perl
lynn

2004-05-07, 8:41 am

Hello everybody,

I am in trouble:

I am trying to just fill a html form and submit the data to a second
script nameage.cgi (perl language) . But even if the httpd.conf have
Scriptalias /cgi-bin/ "/Library/Webserver/CGI-Executables", AddHandler
cgi-script .cgi, ExecCGI option, I do not manage to execute the cgi
script = it print the script in the web browser but no real result is
given. What can I do ?

Thanks in advance.

Here are the scripts:

TEST.html =

<html> <head>
<title>Name and Age</title>
</head>
<body>
<form action="/Library/Webserver/CGI-Executables/nameage.cgi"
method=POST>
Enter your name: <input type=text name="name"><p>
Enter your age: <input type=text name="age"><p>
<input type=submit>
</form>
</body> </html>

name.cgi =

#!/usr/local/bin/perl
# nameage.cgi
require 'cgi-lib.pl'
&ReadParse(*input);
print "Content-Type: text/html\r\n\r\n";
print "<html> <head>\n";
print "<title>Name and Age</title>\n";
print "</head>\n";
print "<body>\n";
print "Hello, " . $input{'name'} . ". You are\n";
print $input{'age'} . " years old.<p>\n";
print "</body> </html>\n";
David Logan

2004-05-11, 8:22 pm

lynn wrote:
> Hello everybody,
>
> I am in trouble:
>
> I am trying to just fill a html form and submit the data to a second
> script nameage.cgi (perl language) . But even if the httpd.conf have
> Scriptalias /cgi-bin/ "/Library/Webserver/CGI-Executables", AddHandler
> cgi-script .cgi, ExecCGI option, I do not manage to execute the cgi
> script = it print the script in the web browser but no real result is
> given. What can I do ?
>
> Thanks in advance.


I did not need AddHandler in httpd.conf. Mine is still commented out and
works just fine. I also did not need to put ExecCGI in my Options
statement either. I assume these were built in or enabled at build time.

>
> Here are the scripts:
>
> TEST.html =
>
> <html> <head>
> <title>Name and Age</title>
> </head>
> <body>
> <form action="/Library/Webserver/CGI-Executables/nameage.cgi"


Your ScriptAlias is /cgi-bin/. That means your action should be:
action=/cgi-bin/nameage.cgi

> method=POST>
> Enter your name: <input type=text name="name"><p>
> Enter your age: <input type=text name="age"><p>
> <input type=submit>
> </form>
> </body> </html>
>
> name.cgi =
>
> #!/usr/local/bin/perl
> # nameage.cgi
> require 'cgi-lib.pl'
> &ReadParse(*input);
> print "Content-Type: text/html\r\n\r\n";
> print "<html> <head>\n";
> print "<title>Name and Age</title>\n";
> print "</head>\n";
> print "<body>\n";
> print "Hello, " . $input{'name'} . ". You are\n";
> print $input{'age'} . " years old.<p>\n";
> print "</body> </html>\n";

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com