×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

First Time CGI

First Time CGI

First Time CGI

(OP)
Running Windows 2000 and Apache.  

ActivePerl is installed in C:\Perl\bin
CGI-Bin is located at C:\c-web\cgi-bin
Web is located at C:\c-web\
Permisions are set to allow everyone full access.

I've started with just a simple CGI script to collect usernames and emails.  My website displays correctly but when I click submit on my form all I see is my .cgi script not the returned data I should be seeing.  I think it's because I don't have the first line in the .cgi file correct.  

Currently it is:
#!C:\Perl\bin\perl.exe

RE: First Time CGI

You need an http server if you want to run cgi scripts from a browser. Apache is free and there are many tutorails that explain how to set it up.

www.apache.org  

- Kevin, perl coder unexceptional! wiggle

RE: First Time CGI

(OP)
Per my first post.  I am running Apache.  My websites are working fine.  It's the CGI that is not.

RE: First Time CGI

sorry, I missed the running apache part somehow. Then it's a setup problem. Google for an apache tutorial for the version of apache you are using. Here is one but I don't know if it covers your version of apache:

http://www.thesitewizard.com/archive/addcgitoapache.shtml

- Kevin, perl coder unexceptional! wiggle

RE: First Time CGI

(OP)
Thanks for the link.  I did have some permissions set incorrectly.  But I still can't get the CGI to work.  I get a 404 error saying the requested url is not found.



Below is my code:

FILE NAME: porequest.cgi

#!C:\Program Files\Perl\bin\perl.exe
read(STDIN,$temp,$ENV{'CONTENT_LENGTH'});
@pairs=split(/&/,$temp);
foreach $item(@pairs)
 {
  ($key,$content)=split(/=/,$item,2);
  $content=~tr/+/ /;
  $content=~s/%(..)/pack("c",hex($1))/ge;
  $fields{$key}=$content;
 }   
 
 
print "Content-type: text/html\n\n";
print "<HTML>\n";
print "<BODY BGCOLOR=#FFFFFF>\n";
print "<CENTER>\n";
print "THANK YOU<BR>\n";
print "$fields{fname} $fields{lname}</BR>";
print "I will write<BR>\n";
print "you at<BR>\n";
print "$fields{email}<BR>\n";
print "</CENTER>\n";
print "</BODY></HTML>";


FILE NAME: porequest.html

<HTML>
<BODY>
<FORM METHOD="POST" ACTION="/cgi-bin/porequest.cgi">
<PRE>
    First Name  <INPUT TYPE="text" NAME="fname" MAXLENGTH=15 SIZE=15>
    Last Name   <INPUT TYPE="text" NAME="lname"  MAXLENGTH=20 SIZE=20>
    E-Mail Addr <INPUT TYPE="text" NAME="email"  MAXLENGTH=35 SIZE=35>         
                <INPUT TYPE="submit" VALUE="Send Mail!">
                <INPUT TYPE="reset" value=" Clear-Form">
</PRE>
</FORM>
</BODY>
</HTML>

RE: First Time CGI

Hi

If it is error 404, the request does not even reach to the CGI script, the URL is incorrect. Theoretically in should be :

http://localhost/cgi-bin/porequest.cgi

What is your URL ?

Feherke.
http://rootshell.be/~feherke/

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close