Syed, please show some constraint in how many time you post the same email to this list. Thank you. Regarding your question, is the cgi script in the same directory as your HTML? What kind of webserver are you running this on? How do you get the form in netscape, do you just load the file or do you access it through your webserver? If the latter, and the URL you type is something like http://mywebserver.com/form.html, try running the script with http://mywebserver.com/survey.cgi. If this does not work, you may need to put your script in a cgi directory or alternatively tell your webserver it can run scripts in the directory the script is in. I will help you getting this running, but your question is so trivial that I don't think it's neccesary to keep sending this to the list, so when you reply, just reply to me only, ok? -Fred Syed Shah wrote: > > I ran the following in Netscape. However, when I click submit it does not > anywhere. The CGI program is in the same directory as this file. Please > help. Thanks. > > <HTML> > <HEAD> > <title>A SURVEY FORM</TITLE> > </HEAD> > <BODY> > <H2> A Survey Form</h2> > <FORM ACTION="survey.cgi" METHOD="post"> > <P>Name: <INPUT TYPE="text" NAME="name" SIZE=30 MAXSIZE=50> > </P> > <P> <INPUT TYPE="checkbox" NAME="Purchaser" Value="yes"> > I am authorized to make purchased. > </P> > <P> > IT Budget:<BR> > <INPUT TYPE="radio" NAME="budget" VALUE="10000">Less Than $10,000<BR> > <INPUT TYPE="radio" NAME="budget" VALUE="100000">From $10,000 to $100,000<BR> > <INPUT TYPE="radio" NAME="budget" VALUE="1000000">From $100,000 to > $1,000,00<BR> > </p> > <p> > Current Job Responsibility: > <SELECT NAME="JOB" SIZE=1> > <OPTION VALUE="senior">Senior Management > <OPTION VALUE="management">Management > <OPTION VALUE="engineer">Engineer > <OPTION VALUE="conultant">Consultant > </SELECT> > </P> > <p> > Comment:<BR> > <TEXTAREA NAME="comments" WRAP="virtual" cols=60 rows=10></TEXTAREA> > </p> > > <p> > Color:<BR> > <SELECT NAME="color" SIZE=1> > <OPTION VALUE="red">Red > <OPTION VALUE="blue">Blue > <OPTION VALUE="yellow">Yellow > </SELECT> > </P> > > <p> > Operating System:<br> > <SELECT NAME="operating-system" SIZE=4 MULTIPLE> > <OPTION VALUE="macos">MAC > <OPTION VALUE="linux">Linux > <OPTION VALUE="freebsd">FreeBSD > <OPTION VALUE="windows">Windows > </SELECT> > </P> > <P> > <INPUT TYPE="submit"> > <INPUT TYPE="reset"> > </P> > </FORM> > </BODY> > </HTML> > > The CGI file is: > > #!c:\perl\bin\perl.exe > #/usr/local/bin/perl > > print "Content-type:text/html\n\n"; > > read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); > > @pairs = split(/&/, $buffer); > > foreach $pair (@pairs) { > > ($name, $value) = split(/=/, $pair); > > $value =~ tr/+/ /; > > $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; > > $value =~ s/\n/ /g; # replace newlines with spaces > > $value =~ s/\r//g; # remove hard returns > > $value =~ s/\cM//g; # delete ^M's > > $FORM{$name} = $value; > > } > > open(OUTF,">>survey.out") or dienice("Couldn't open survey.out for > > writing: $!"); > > # This locks the file so no other CGI can write to it at the > > # same time... > > flock(OUTF,2); > # Reset the file pointer to the end of the file, in case > > # someone wrote to it while we waited for the lock... > > seek(OUTF,0,2); > > print OUTF "$FORM{'name'}|$FORM{'email'}|"; > > print OUTF "$FORM{'howreach'}|$FORM{'rating'}|"; > > %boxes = ( "des" => "Website Design", > > "svr" => "Web Server Administration", > > "com" => "Electronic Commerce", > > "mkt" => "Web Marketing/Advertising", > > "edu" => "Web-Related Education" ); > > foreach $key (keys %boxes) { > > if ($FORM{$key} == 1) { > print OUTF "$key,"; > > } > > } > > print OUTF "|$FORM{'comments'}\n"; > > close(OUTF); > > print <<EndHTML; > > <html><head><title>Thank You</title></head> > > <body> > > <h2>Thank You!</h2> > > Thank you for your feedback.<p> > > <a href="index.html">Return to our home page</a><p> > > </body></html> > > EndHTML > > sub dienice { > > my($msg) = @_; > > print "<h2>Error</h2>\n"; > > print $msg; > > exit; > > }
