- From: Stu Harris <sirrah@baluga.maximumaccess.com>
- Date: Fri, 13 Dec 1996 18:19:41 -0800 (PST)
- To: Fred_Deroche_at_corpsoftnorwood4@stream.com
- Cc: www-html@w3.org
> Please help me understand what I'm doing wrong... > When I click/press the submit key, my HTML file > displays my CGI file on the screen ... > > I want it to add to a file (fred.txt) and not display it results... > > thanks, fred > > > **********this is fred.htm*************** > <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.0//EN"> > <HTML>... > <form method="post" action="./fred.cgi"> There's quite a bit wrong with this, but the first thing is that the above line suggests you're trying to run CGI in the same directory as html. This has the undesirable and highly insecure effect of printing out the text of your perl rountine on the user's screen, as you have noticed. Create a directory beneath your html directory (NOT at the same level). This is usually called cgi-bin. Next, find out what needs to be done to validate cgi in that directory. You may need an .htaccess file, or it might be simply a matter of permissions on the server. Put fred down there and chmod a+x fred.ci. The above line will now need to be: <form method="post" action="cgi-bin/fred.cgi"> That'll move you on to the next bunch of things that are wrong with your code..... > **********this is fred.cgi*************** > #!/usr/bin/perl > .... > open ( MAIL, ">> fred.txt") || die print " cannot open mailprog"; > print MAIL "name=" $contents('name') \n; > print MAIL "org= " $contents('org') \n; > print MAIL "tele=" $contents('tele') \n; > close(mail); > Wozzis $contents( ) array???? Did you create it from the incoming name=value pairs up there while the row of dots was happening? I sure hope so, because it has no meaning otherwise. Quite possibly your parentheses need to become braces, too. I could moan on but I'll stop right there and hope I've been helpful. Stu
Received on Friday, 13 December 1996 21:33:01 UTC