develooper Front page | perl.libwww | Postings from July 2001

Re: Perl

From:
gil cohen
Date:
July 22, 2001 16:44
Subject:
Re: Perl
Message ID:
F170L3zbtmWxT1OdpGO00002f2c@hotmail.com
Am I the only person that got this email 6 times?



>From: Syed Shah <shaha1s@mail.cmich.edu>
>To: libwww@perl.org
>Subject: Perl
>Date: Sun, 22 Jul 2001 19:31:27 -0400
>MIME-Version: 1.0
>Received: from [209.85.157.220] by hotmail.com (3.2) with ESMTP id 
>MHotMailBD24AD620051400438DAD1559DDC04C10; Sun, 22 Jul 2001 16:31:47 -0700
>Received: (qmail 12115 invoked by uid 1005); 22 Jul 2001 23:31:45 -0000
>Received: (qmail 12101 invoked from network); 22 Jul 2001 23:31:45 -0000
>Received: from mail.cmich.edu (HELO mail.csv.cmich.edu) (141.209.15.40)  by 
>onion.valueclick.com with SMTP; 22 Jul 2001 23:31:45 -0000
>Received: from hppav.mail.cmich.edu ([207.74.81.150]) by          
>mail.csv.cmich.edu (Netscape Messaging Server 4.15) with ESMTP          id 
>GGWEOT00.HQT for <libwww@perl.org>; Sun, 22 Jul 2001 19:31:41 -0400
>From libwww-return-2800-cohengil4 Sun, 22 Jul 2001 16:33:10 -0700
>Mailing-List: contact libwww-help@perl.org; run by ezmlm
>Precedence: bulk
>list-help: <mailto:libwww-help@perl.org>
>list-unsubscribe: <mailto:libwww-unsubscribe@perl.org>
>list-post: <mailto:libwww@perl.org>
>Delivered-To: mailing list libwww@perl.org
>Message-Id: <4.3.1.2.20010722193114.00ac58d0@mail.cmich.edu>
>X-Sender: shaha1s@mail.cmich.edu
>X-Mailer: QUALCOMM Windows Eudora Version 4.3.1
>X-Spam-Rating: onion.valueclick.com 1.6.2 0/1000/N
>
>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;
>
>}
>


_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About