Hi im totally new to perl this is my first go at using it (I normally use asp).
I have set up a form with a cgi script from demon hosting. I have edited the script and the form works it sends me an email. however all the information is missing form the email I only get the first form text field??
-
#!/bin/perl
-
-
-
-
-
-
# ------------------------------------------------------------
-
-
# Form-mail.pl, by Reuven M. Lerner (reuven@the-tech.mit.edu).
-
-
#
-
-
# Last updated: March 14, 1994
-
-
#
-
-
# Form-mail provides a mechanism by which users of a World-
-
-
# Wide Web browser may submit comments to the webmasters
-
-
# (or anyone else) at a site. It should be compatible with
-
-
# any CGI-compatible HTTP server.
-
-
#
-
-
# Please read the README file that came with this distribution
-
-
# for further details.
-
-
# ------------------------------------------------------------
-
-
-
-
# ------------------------------------------------------------
-
-
# This package is Copyright 1994 by The Tech.
-
-
-
-
# Form-mail is free software; you can redistribute it and/or modify it
-
-
# under the terms of the GNU General Public License as published by the
-
-
# Free Software Foundation; either version 2, or (at your option) any
-
-
# later version.
-
-
-
-
# Form-mail is distributed in the hope that it will be useful, but
-
-
# WITHOUT ANY WARRANTY; without even the implied warranty of
-
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-
-
# General Public License for more details.
-
-
-
-
# You should have received a copy of the GNU General Public License
-
-
# along with Form-mail; see the file COPYING. If not, write to the Free
-
-
# Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
-
-
# ------------------------------------------------------------
-
-
-
-
# Define fairly-constants
-
-
-
-
# This should be set to the username or alias that runs your WWW server.
-
-
$recipient = 'sales@mywebsite.co.uk';
-
-
-
-
# This should be set to the URL of your home page, or wherever
-
-
# you wish users to return.
-
-
$homepage = 'http://www.mywebsite.co.uk';
-
-
-
-
# This should match the mail program on your system.
-
-
$mailprog = '/usr/lib/sendmail';
-
-
-
-
# Print out a content-type for HTTP/1.0 compatibility
-
-
print "Content-type: text/html\n\n";
-
-
-
-
# Print a title and initial heading
-
-
print "<Head><Title>Thank you</Title></Head>";
-
-
print "<Body><H1>Thank you</H1>";
-
-
-
-
# Get the input
-
-
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
-
-
-
-
# Split the name-value pairs
-
-
@pairs = split(/&/, $buffer);
-
-
-
-
foreach $pair (@pairs)
-
-
{
-
-
($name, $value) = split(/=/, $pair);
-
-
-
-
# Un-Webify plus signs and %-encoding
-
-
$value =~ tr/+/ /;
-
-
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
-
-
-
-
# Stop people from using subshells to execute commands
-
-
# Not a big deal when using sendmail, but very important
-
-
# when using UCB mail (aka mailx).
-
-
# $value =~ s/~!/ ~!/g;
-
-
-
-
# Uncomment for debugging purposes
-
-
# print "Setting $name to $value<P>";
-
-
$FORM{$name} = $value;
-
-
}
-
-
-
-
# If the comments are blank, then give a "blank form" response
-
-
#&blank_response unless $FORM{'FirstName'};
-
-
#&blank_response unless $FORM{'LastName'};
-
-
#&blank_response unless $FORM{'StreetAddress'};
-
-
#&blank_response unless $FORM{'City'};
-
-
#&blank_response unless $FORM{'County'};
-
-
#&blank_response unless $FORM{'PostCode'};
-
-
#&blank_response unless $FORM{'WorkPhoneNumber'};
-
-
#&blank_response unless $FORM{'Email'};
-
-
-
-
# Now send mail to $recipient
-
-
-
-
open (MAIL, "|$mailprog $recipient") || die "Can't open $mailprog!\n";
-
-
print MAIL "Reply-to: $FORM{'Email'} ($FORM{'LastName'})\n";
-
-
print MAIL "Subject: mywebsite trade account applications (Forms submission)\n\n";
-
-
print MAIL "$FORM{'FirstName'} ($FORM{'LastName'}) sent the following\n";
-
-
print MAIL "mywebsite trade account application for \n\n";
-
-
print MAIL "------------------------------------------------------------\n";
-
-
print MAIL "$FORM{'FirstName'}";
-
-
print MAIL "$FORM{'LastName'}";
-
-
print MAIL "$FORM{'StreetAddress'}";
-
-
print MAIL "$FORM{'Address2'}";
-
-
print MAIL "$FORM{'City'}";
-
-
print MAIL "$FORM{'County'}";
-
-
print MAIL "$FORM{'PostCode'}";
-
-
print MAIL "$FORM{'WorkPhoneNumber'}";
-
-
print MAIL "$FORM{'HomePhoneNumber'}";
-
-
print MAIL "$FORM{'FAX'}";
-
-
print MAIL "$FORM{'Email'}";
-
-
print MAIL "$FORM{'CashOrCredit'}";
-
-
print MAIL "$FORM{'Ref1_Company'}";
-
-
print MAIL "$FORM{'Ref1_StreetAddress'}";
-
-
print MAIL "$FORM{'Ref1_Address'}";
-
-
print MAIL "$FORM{'Ref1_City'}";
-
-
print MAIL "$FORM{'Ref1__County'}";
-
-
print MAIL "$FORM{'Ref1_PostCode'}";
-
-
print MAIL "$FORM{'Ref1_PhoneNumber'}";
-
-
print MAIL "$FORM{'Ref1_FAX'}";
-
-
print MAIL "$FORM{'Ref1_Email'}";
-
-
print MAIL "$FORM{'Ref2_Company'}";
-
-
print MAIL "$FORM{'Ref2_StreetAddress'}";
-
-
print MAIL "$FORM{'Ref2_Address'}";
-
-
print MAIL "$FORM{'Ref2_City'}";
-
-
print MAIL "$FORM{'Ref2__County'}";
-
-
print MAIL "$FORM{'Ref2_PostCode'}";
-
-
print MAIL "$FORM{'Ref2_PhoneNumber'}";
-
-
print MAIL "$FORM{'Ref2_FAX'}";
-
-
print MAIL "$FORM{'Ref2_Email'}";
-
-
print MAIL "\n------------------------------------------------------------\n";
-
-
print MAIL "Server protocol: $ENV{'SERVER_PROTOCOL'}\n";
-
-
#print MAIL "Remote host: $ENV{'REMOTE_HOST'}\n";
-
-
print MAIL "Remote IP address: $ENV{'REMOTE_ADDR'}\n";
-
-
close (MAIL);
-
-
-
-
# Make the person feel good for writing to us
-
-
print "Thank you for your request, your e-mail is on its way to our Flimwell Office<P>";
-
-
print "Return to our <A HREF='http://www.mywebsite.co.uk'>home page</A>, if you want.<P>";
-
-
-
-
# ------------------------------------------------------------
-
-
# subroutine blank_response
-
-
sub blank_response
-
-
{
-
-
print "Your comments appear to be blank, and thus were not sent ";
-
-
print "to our webmasters. Please re-enter your comments, or ";
-
-
print "return to our <A HREF='http://www.mywebsite.co.uk'>home page</A>, if you want.<P>";
-
-
exit;
-
-
}
-
-
the email works but returns :-
simon
LastName () sent the following
mywebsite trade account application for
------------------------------------------------------------
simon
LastName
------------------------------------------------------------
Server protocol: HTTP/1.1
Remote IP address: 83.104.77.213
i know its a simple out dated script but i cant see what is wrong with it???