help? my cgi script won't work 
Author Message
 help? my cgi script won't work

I am writing a simple CGI script program using PERL

I have placed the following code at
C:\apache\apache2\htdocs\index.html

<html><head><title> Are you old enough to vote?</title></head>
<body>

<h1>Are you old enough to vote?</h1>
<p>
<form action="/cgi-bin/voter.pl">
Age:<Input Type="text" name="age">
<input type="submit">
</form>
</p>
</body>
</html>

I have then placed the following code at
C:\apache\apache2\cgi-bin\voter.pl

#! c:\perl\bin\perl.exe

print "Content-type:text/html\n\n";

use CGI;
$query=new cgi;

if ($query->param('age')>=18) {
$voter='yes';

Quote:
}

else{
        $voter='no';
Quote:
}

print"<html><head><title>Are you old enough to
vote?</title></head><body>\n";
print "<h1>Are you old enough to vote?</h1>\n";
if ($voter eq 'yes') {
        print "<P>You are old enough to vote.</p>\n";
Quote:
}

else {
        print "<p>You are not yet old enough to vote.</p>\n";
Quote:
}

print "</body></html>\n";

When I call up the form, privide input and click submit button a blank
browser window comes up with the following url address
http://localhost/cgi-bin/voter.pl?age=12

Any help is appreciated!  Thanks.



Sun, 07 Nov 2004 13:16:43 GMT  
 help? my cgi script won't work

Quote:
> I am writing a simple CGI script program using PERL

> I have placed the following code at
> C:\apache\apache2\htdocs\index.html
[...]
> I have then placed the following code at
> C:\apache\apache2\cgi-bin\voter.pl

[...]

Quote:
> When I call up the form, privide input and click submit button a blank
> browser window comes up with the following url address
> http://localhost/cgi-bin/voter.pl?age=12

So, what does your script do when called from the command line? Does it
generate the desired HTML code?
- If yes, then you may want to check "perldoc -q 500".
- If no, then please let us know where the generated output is different
from the intended output then I'm sure someone here can fix that.
- If you don't know how the generated HTML code should look like then I
strongly suggest asking in a newsgroup that actually cares about HTML, web
authoring, CGI, etc.

BTW: "perldoc -q CGI" has a couple of interesting articles about how to
debug Perl CGI scripts. You may want to read those first.

jue



Mon, 08 Nov 2004 01:42:27 GMT  
 help? my cgi script won't work

Quote:
> $query=new cgi;

There should be $query=new CGI;

Quote:
> When I call up the form, privide input and click submit button a blank
> browser window comes up with the following url address
> http://localhost/cgi-bin/voter.pl?age=12

> Any help is appreciated!  Thanks.

Also take a look at Apache error log file, it seems on your pc it is located
at :\apache\apache2\logs\error.log

Michael



Mon, 08 Nov 2004 04:59:14 GMT  
 help? my cgi script won't work
What version of Active Perl are you using, what's your OS/version, and since
when does #! blah blah work under DOS or Windows?  (if something has changed
since the last time I jacked with Active Perl, someone please let me know.
I quit using it when I found out how hard it was to implement certain
standard Unix/Linux features within Windows.)


Thu, 11 Nov 2004 06:58:07 GMT  
 help? my cgi script won't work
Richard,

 Hello I noticed your post with the code below.   It looks familiar.  Are
you by any chance reading the book titled "Teach Yourself CGI in 24 Hours"
If so let me know maybe we can converse I am trying to learn CGI also my
email address is below:


                   -   Warren Bullock III


Quote:
> I am writing a simple CGI script program using PERL

> I have placed the following code at
> C:\apache\apache2\htdocs\index.html

> <html><head><title> Are you old enough to vote?</title></head>
> <body>

> <h1>Are you old enough to vote?</h1>
> <p>
> <form action="/cgi-bin/voter.pl">
> Age:<Input Type="text" name="age">
> <input type="submit">
> </form>
> </p>
> </body>
> </html>

> I have then placed the following code at
> C:\apache\apache2\cgi-bin\voter.pl

> #! c:\perl\bin\perl.exe

> print "Content-type:text/html\n\n";

> use CGI;
> $query=new cgi;

> if ($query->param('age')>=18) {
> $voter='yes';
> }
> else{
> $voter='no';
> }
> print"<html><head><title>Are you old enough to
> vote?</title></head><body>\n";
> print "<h1>Are you old enough to vote?</h1>\n";
> if ($voter eq 'yes') {
> print "<P>You are old enough to vote.</p>\n";
> }
> else {
> print "<p>You are not yet old enough to vote.</p>\n";
> }
> print "</body></html>\n";

> When I call up the form, privide input and click submit button a blank
> browser window comes up with the following url address
> http://localhost/cgi-bin/voter.pl?age=12

> Any help is appreciated!  Thanks.



Thu, 11 Nov 2004 08:16:29 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. why won't this cgi script work?

2. perl script won't work as cgi

3. die won't work in cgi scripts?

4. why won't the cgi work

5. CGI won't work in Netscape browser

6. perl5.003 and now CGI won't work

7. perl in cgi-bin of apache in win98 won't work

8. ??Redirect Script Won't Work With Win95???

9. Why won't this script work???

10. Llama book script won't work?

11. Why won't this little script work?

12. Why won't this simple script work??

 

 
Powered by phpBB® Forum Software