Lost has asked for the wisdom of the Perl Monks concerning the following question:

Still trying to figure out why my clients "Contact Us" form isn't being parsed correctly. The info his visitors enter into the text fields (Name, Address, Email...etc) aren't being written into the email message.

I've tried:

Checking Open(mail) and close(mail) and don't get any errors in reference to piping...

I've also tried:

CGI::Carp qw(fatalsToBrowser);

and the only error that came up was as follows:

Can't locate object method "new" via package "CGI" (perhaps you forgot to load "CGI"?) at /ssl/formaction.pl line 6.

The script I'm using is as follows:

#!/usr/bin/perl -w use strict; use warnings; use CGI; my $query = new CGI; print "Content-type:text/html\n\n"; my $to='info@Clients URL.net'; my $from='info@Clients URL.net'; my $subject='Email Subject'; my $name = $query->param('name'); my $email = $query->param('email'); my $address1 = $query->param('address1'); my $address2 = $query->param('address2'); my $city = $query->param('city'); my $state = $query->param('state'); my $zip = $query->param('zip'); my $country = $query->param('country'); my $homephone = $query->param('homephone'); my $workphone = $query->param('workphone'); my $business = $query->param('business'); my $goals = $query->param('goals'); my $comments = $query->param('comments'); open(MAIL, "|/usr/sbin/sendmail -t"); print MAIL "To: $to\n"; print MAIL "From: $from\n"; print MAIL "Subject: $subject\n\n"; print MAIL "Name: $name\n"; print MAIL "EMail: $email\n"; print MAIL "Address_line_1: $address1\n"; print MAIL "Address_line_2: $address2\n"; print MAIL "City: $city\n"; print MAIL "State: $state\n"; print MAIL "Zip: $zip\n"; print MAIL "Country: $country\n"; print MAIL "Home_Phone: $homephone\n"; print MAIL "Work_Phone: $workphone\n"; print MAIL "Type_of_Business: $business\n"; print MAIL "Goals: $goals\n"; print MAIL "Comments: $comments\n"; close(MAIL); print "<html><head><title>Clients URL</title> <link href=http://Clients URL css/css/shell3.css rel=stylesheet type=t +ext/css> </head>\n<body>\n"; print "<HR size=2>"; print "<CENTER><H1><U>Message Received!!!</U><P> YOUR business is VERY important to us.<P> <U>We will respond as soon as we can.</U></H1></CENTER>"; print "<P>"; print "<center><a href=http://Clients URL/index.html><I>Clients URL</I +> Home Page</a></center>"; print "<hr size=2>"; print "<FONT size=-2 color=blue>&copy;2004</FONT> <FONT size=-2 color= +red><B><I>Clients Business</I></B></FONT>"; print "</body></html>";

Just to recap: The form sends, the script runs, my client receives the email but the user entered info does not post in the email.

Sincerely,
Lost Edit by castaway closed runawat tt tag

Replies are listed 'Best First'.
Re: Form parsed incorrectly
by saskaqueer (Friar) on May 08, 2004 at 04:42 UTC

    CGI::Carp is a different module. From the error you are getting, I am assuming you replaced use CGI with use CGI::Carp qw(fatalsToBrowser);. Wrong! You need to start off with what I have below. I've included diagnostics to explain any errors in further detail. On top of this, you say you are checking for errors with open() and close()... I don't see that in your code.

    #!/usr/bin/perl -w use strict; use warnings; use diagnostics; use CGI; use CGI::Carp qw(fatalsToBrowser); # rest of script here
Re: Form parsed incorrectly
by Koosemose (Pilgrim) on May 08, 2004 at 04:16 UTC

    Errrm... your error message would seem to imply that either CGI.pm doesn't exist on the machine, or something is wrong with it. Perhaps you should check for it's existence, and maybe check that nothing's wrong with it.

    Just Another Perl Alchemist
Re: Form parsed incorrectly
by Lost (Novice) on May 08, 2004 at 06:28 UTC
    OOPS! Forgot to sign in..That was me above.

    Yes Saskaqueer, I did replace use CGI with use CGI::carp...... Thanks for the tip and I'm sure I'll use it in future scripts.

    Leaving the forum tonight with his tail between his legs, BUT enligntended and better educated,

    Lost

Re: Form parsed incorrectly
by Anonymous Monk on May 08, 2004 at 06:19 UTC
    I figgered it out...and it was so simple and right in front of me that I'm embarassed to even mention it.
    (Let's just say I was updating some info on the form itself and when I went to retype the "action" URL (that I had accidently deleted), I ferget to add the /SSL/ to the address line as it is being run through ssl-capische?)

    Funny how it alwys seems to come back to the basics! How I appreciate your patience of my stupidity

    Sincerely,

    Lost