Here is my form processor. It doesn't work and I cannot find the problem. My server does not tell which line the problem is on. I have tried: CGI::Carp qw(fatalsToBrowser); but it does not make a difference.
#!/usr/bin/perl
&CheckReferingURL;
&ParseForm;
&GetDate;
&SendSubmission;
&SendAutoReply;
if ($Country == "United States of America"
{
$Kissingball_Shipping="2.00";
$Wreath_Shipping="8.50";
}else{
$Kissingball_Shipping="3.50";
$Wreath_Shipping="11.00";
}
$First_Name = param('First_Name');
$Middle_Initial = param('Middle_Initial');
$Last_Name = param('Last_Name');
$Country = param('Country');
$Address = param('Address');
$City = $Config{'City');
$State_or_Province = param('State_or_Province');
$Zip_or_Postal = param('Zip_or_Postal');
$Phone_Number = param('$Phone_Number');
$Email = param('Email');
$Pay_Option = param('Pay_Option');
$Red = param('Red');
$Red_Traditional = param('Red_Traditional');
$Red_Non_Traditional= param('Red_Non_Traditional');
$Blue = param('Blue');
$Blue_Traditional = param('Blue_Traditional');
$Blue_Non_Traditional = param('Blue_Non_Traditional');
$Mauve = param('Mauve');
$Mauve_Traditional = param('Mauve_Traditional');
$Mauve_Non_Traditional = param('Mauve_Non_Traditional');
$Teasel_Teasers = param('Teasel_Teasers');
$Amount_of_Teasel_Teasers = param('Amount_of_Teasel_Teasers');
$Comments = param('Comments');
$Name = "$First_Name $Middle_Initial $Last_Name";
$Wreath_Price="25.00";
$Kissingball_Price="3.00";
$Computer_Name=$ENV{REMOTE_ADDR};
$Browser=$ENV{HTTP_USER_AGENT};
$Referrer=$ENV{HTTP_REFERER};
$email_address="wreath2you\@yahoo.com";
$subject="!!FORM FILLOUT!!";
$autoresponse="yes";
$company_name="Wreath2you";
if ($Red_Traditional == ""
{$Red_Traditional = "0";}
if ($Red_Non_Traditional == ""
{$Red_Non_Traditional = "0";}
if ($Blue_Traditional == ""
{$Blue_Traditional = "0";}
if ($Blue_Non_Traditional == ""
{$Blue_Non_Traditional = "0";}
if ($Mauve_Traditional == ""
{$Mauve_Traditional = "0";}
if ($Mauve_Non_Traditional == ""
{$Mauve_Non_Traditional = "0";}
if ($Amount_of_Teasel_Teasers == ""
{$Amount_of_Teasel_Teasers = "0";}
$Red_Shipping = ($Red_Traditional+$Red_Non_Traditional)*$Wreath_Shipping;
$Red_Price = ($Red_Traditional+$Red_Non_Traditional)*$Wreath_Price;
$Red_Subtotal_Raw_Data = $Red_Price + $Red_Shipping;
$Red_Subtotal = sprintf("%.2f",$Red_Subtotal_Raw_Data);
1 while $Red_Subtotal =~ s/^(\d+)(\d{3})/$1,$2/;
$Red_Subtotal = "\$" . $Red_Subtotal;
$Red_Subtotal = sprintf("%9s\n", $Red_Subtotal);
$Red_Shipping = sprintf("%.2f",$Red_Shipping);
1 while $Red_Shipping =~ s/^(\d+)(\d{3})/$1,$2/;
$Red_Shipping = "\$" . $Red_Shipping;
$Red_Shipping = sprintf("%9s\n", $Red_Shipping);
$Red_Price = sprintf("%.2f",$Red_Price);
1 while $Red_Price =~ s/^(\d+)(\d{3})/$1,$2/;
$Red_Price = "\$" . $Red_Price;
$Red_Price = sprintf("%9s\n", $Red_Price);
if ($Red == "Yes"
{
$Order_Red="
Red:
Traditionals: $Red_Traditional
Non-Traditionals: $Red_Non_Traditional
--------------------
Price For Red Wreaths: $Red_Price
Shipping For Red Wreaths: $Red_Shipping
Subtotal: $Red_Subtotal
";
} else {$Order_Red="";}
$Blue_Shipping = ($Blue_Traditional+$Blue_Non_Traditional)*$Wreath_Shipping;
$Blue_Price = ($Blue_Traditional+$Blue_Non_Traditional)*$Wreath_Price;
$Blue_Subtotal_Raw_Data = $Blue_Price + $Blue_Shipping;
$Blue_Subtotal = sprintf("%.2f",$Blue_Subtotal_Raw_Data);
1 while $Blue_Subtotal =~ s/^(\d+)(\d{3})/$1,$2/;
$Blue_Subtotal = "\$" . $Blue_Subtotal;
$Blue_Subtotal = sprintf("%9s\n", $Blue_Subtotal);
$Blue_Shipping = sprintf("%.2f",$Blue_Shipping);
1 while $Blue_Shipping =~ s/^(\d+)(\d{3})/$1,$2/;
$Blue_Shipping = "\$" . $Blue_Shipping;
$Blue_Shipping = sprintf("%9s\n", $Blue_Shipping);
$Blue_Price = sprintf("%.2f",$Blue_Price);
1 while $Blue_Price =~ s/^(\d+)(\d{3})/$1,$2/;
$Blue_Price = "\$" . $Blue_Price;
$Blue_Price = sprintf("%9s\n", $Blue_Price);
if ($Blue == "Yes"
{
$Order_Blue="
Blue:
Traditionals: $Blue_Traditional
Non-Traditionals: $Blue_Non_Traditional
--------------------
Price For Blue Wreaths: $Blue_Price
Shipping For Blue Wreaths: $Blue_Shipping
Subtotal: $Blue_Subtotal
";
} else {$Order_Blue="";}
$Mauve_Shipping = ($Mauve_Traditional+$Mauve_Non_Traditional)*$Wreath_Shipping;
$Mauve_Price = ($Mauve_Traditional+$Mauve_Non_Traditional)*$Wreath_Price;
$Mauve_Subtotal_Raw_Data = $Mauve_Price + $Mauve_Shipping;
$Mauve_Subtotal = sprintf("%.2f",$Mauve_Subtotal_Raw_Data);
1 while $Mauve_Subtotal =~ s/^(\d+)(\d{3})/$1,$2/;
$Mauve_Subtotal = "\$" . $Mauve_Subtotal;
$Mauve_Subtotal = sprintf("%9s\n", $Mauve_Subtotal);
$Mauve_Shipping = sprintf("%.2f",$Mauve_Shipping);
1 while $Mauve_Shipping =~ s/^(\d+)(\d{3})/$1,$2/;
$Mauve_Shipping = "\$" . $Mauve_Shipping;
$Mauve_Shipping = sprintf("%9s\n", $Mauve_Shipping);
$Mauve_Price = sprintf("%.2f",$Mauve_Price);
1 while $Mauve_Price =~ s/^(\d+)(\d{3})/$1,$2/;
$Mauve_Price = "\$" . $Mauve_Price;
$Mauve_Price = sprintf("%9s\n", $Mauve_Price);
if ($Mauve == "Yes"
{
$Order_Mauve="
Mauve:
Traditionals: $Mauve_Traditional
Non-Traditionals: $Mauve_Non_Traditional
--------------------
Price For Mauve Wreaths: $Mauve_Price
Shipping For Mauve Wreaths: $Mauve_Shipping
Subtotal: $Mauve_Subtotal
";
} else {$Order_Mauve="";}
$Teaser_Price = $Amount_of_Teasel_Teasers * $Kissingball_Price;
$Teaser_Shipping = $Amount_of_Teasel_Teasers * $Kissingball_Shipping;
$Teaser_Subtotal_Raw_Data = $Teaser_Price + $Teaser_Shipping;
$Teaser_Subtotal = sprintf("%.2f",$Teaser_Subtotal_Raw_Data);
1 while $Teaser_Subtotal =~ s/^(\d+)(\d{3})/$1,$2/;
$Teaser_Subtotal = "\$" . $Teaser_Subtotal;
$Teaser_Subtotal = sprintf("%9s\n", $Teaser_Subtotal);
$Teaser_Shipping = sprintf("%.2f",$Teaser_Shipping);
1 while $Teaser_Shipping =~ s/^(\d+)(\d{3})/$1,$2/;
$Teaser_Shipping = "\$" . $Teaser_Shipping;
$Teaser_Shipping = sprintf("%9s\n", $Teaser_Shipping);
$Teaser_Price = sprintf("%.2f",$Teaser_Price);
1 while $Teaser_Price =~ s/^(\d+)(\d{3})/$1,$2/;
$Teaser_Price = "\$" . $Teaser_Price;
$Teaser_Price = sprintf("%9s\n", $Teaser_Price);
if ($Teasel_Teasers == "Yes"
{
$Order_Teaser="
Teasel Teasers:
Quantity: $Amount_of_Teasel_Teasers
--------------------
Price For Teasle Teaser: $Teaser_Price
Shipping For Teasle Teaser: $Teaser_Shipping
Subtotal: $Teaser_Subtotal
";
} else {$Order_Teaser="";}
$Cost = $Red_Subtotal_Raw_Data+$Blue_Subtotal_Raw_Data+$Mauve_Subtotal_Raw_Data+$Teaser_Subtotal_Raw_Data;
$Cost = sprintf("%.2f",$Cost);
1 while $Cost =~ s/^(\d+)(\d{3})/$1,$2/;
$Cost = "\$" . $Cost;
$Cost = sprintf("%9s\n", $Cost);
$response_subject="Thank You For Ordering!";
$response_mail="Thank you $First_Name $Middle_Initial, $Last_Name for your order of
$Order_Red $Order_Blue $Order_Mauve $Order_Teaser
------------------------
Total Cost: $Cost
Pay Option: $Pay_Option
We will respond as quickly as we can. We hope that you will enjoy our product.
Wreath2you";
$thank_you_page="wreaths.port5.com/thankyou.html";
$error_page="wreaths.port5.com/index.html";
$custom_message="
Name: $First_Name $Middle_Initial, $Last_Name
Address:
$Address
$City, $State_or_Province $Zip_or_Postal
$Country
Phone Number: $Phone_Number
Email: $Email
--------------------------------------------------------------
Order:
$Order_Red $Order_Blue $Order_Mauve $Order_Teaser
------------------------
Total Cost: $Cost
Pay Option: $Pay_Option
--------------------------------------------------------------
Comments:
$Comments
--------------------------------------------------------------
SENDER INFO:
IP: $REMOTE_ADDR
Computer Name: $Computer_Name
Browser Type: $Browser
Page Referer: $Referrer
--------------------------------------------------------------";
print "Location: wreaths.port5.com/thankyou.html\n\n";
exit;
sub SendSubmission {
open (MAIL,"|/usr/lib/sendmail -t"
;
print MAIL "To: wreath2you@yahoo.com\n";
print MAIL "From: $Email\n";
print MAIL "Subject: !!FORM FILLOUT!!\n";
print MAIL "$Date\n\n";
print MAIL "E-Mail Message\n\n";
print MAIL "From: $Name\n";
print MAIL "Email: $Email\n\n";
print MAIL "$custom_message";
close (MAIL);
}
sub SendAutoReply {
open (MAIL,"|$MailProgram -t"
;
print MAIL "To: $Email\n";
print MAIL "From: wreath2you@yahoo.com\n";
print MAIL "Subject: Thanks for ordering!\n";
print MAIL "$\n";
print MAIL "$Date\n\n";
print MAIL "Thanks for you message!\n\n";
print MAIL "$response_mail";
close (MAIL);
}
sub GetDate {
@days = ('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
@months = ('01','02','03','04','05','06','07','08','09','10','11','12');
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$year = $year+1900;
$Date = "$days[$wday] $months[$mon]/$mday/$year";
sub CheckReferingURL {
if ($ENV{'HTTP_REFERER'}) {
if ($ENV{'HTTP_REFERER'} =~ " /i) {
$check_referer = '1';
}}
else {$check_referer = '1';}
if ($check_referer != 1) {
print "Location: exit;
}}
exit;
}
#!/usr/bin/perl
&CheckReferingURL;
&ParseForm;
&GetDate;
&SendSubmission;
&SendAutoReply;
if ($Country == "United States of America"
$Kissingball_Shipping="2.00";
$Wreath_Shipping="8.50";
}else{
$Kissingball_Shipping="3.50";
$Wreath_Shipping="11.00";
}
$First_Name = param('First_Name');
$Middle_Initial = param('Middle_Initial');
$Last_Name = param('Last_Name');
$Country = param('Country');
$Address = param('Address');
$City = $Config{'City');
$State_or_Province = param('State_or_Province');
$Zip_or_Postal = param('Zip_or_Postal');
$Phone_Number = param('$Phone_Number');
$Email = param('Email');
$Pay_Option = param('Pay_Option');
$Red = param('Red');
$Red_Traditional = param('Red_Traditional');
$Red_Non_Traditional= param('Red_Non_Traditional');
$Blue = param('Blue');
$Blue_Traditional = param('Blue_Traditional');
$Blue_Non_Traditional = param('Blue_Non_Traditional');
$Mauve = param('Mauve');
$Mauve_Traditional = param('Mauve_Traditional');
$Mauve_Non_Traditional = param('Mauve_Non_Traditional');
$Teasel_Teasers = param('Teasel_Teasers');
$Amount_of_Teasel_Teasers = param('Amount_of_Teasel_Teasers');
$Comments = param('Comments');
$Name = "$First_Name $Middle_Initial $Last_Name";
$Wreath_Price="25.00";
$Kissingball_Price="3.00";
$Computer_Name=$ENV{REMOTE_ADDR};
$Browser=$ENV{HTTP_USER_AGENT};
$Referrer=$ENV{HTTP_REFERER};
$email_address="wreath2you\@yahoo.com";
$subject="!!FORM FILLOUT!!";
$autoresponse="yes";
$company_name="Wreath2you";
if ($Red_Traditional == ""
if ($Red_Non_Traditional == ""
if ($Blue_Traditional == ""
if ($Blue_Non_Traditional == ""
if ($Mauve_Traditional == ""
if ($Mauve_Non_Traditional == ""
if ($Amount_of_Teasel_Teasers == ""
$Red_Shipping = ($Red_Traditional+$Red_Non_Traditional)*$Wreath_Shipping;
$Red_Price = ($Red_Traditional+$Red_Non_Traditional)*$Wreath_Price;
$Red_Subtotal_Raw_Data = $Red_Price + $Red_Shipping;
$Red_Subtotal = sprintf("%.2f",$Red_Subtotal_Raw_Data);
1 while $Red_Subtotal =~ s/^(\d+)(\d{3})/$1,$2/;
$Red_Subtotal = "\$" . $Red_Subtotal;
$Red_Subtotal = sprintf("%9s\n", $Red_Subtotal);
$Red_Shipping = sprintf("%.2f",$Red_Shipping);
1 while $Red_Shipping =~ s/^(\d+)(\d{3})/$1,$2/;
$Red_Shipping = "\$" . $Red_Shipping;
$Red_Shipping = sprintf("%9s\n", $Red_Shipping);
$Red_Price = sprintf("%.2f",$Red_Price);
1 while $Red_Price =~ s/^(\d+)(\d{3})/$1,$2/;
$Red_Price = "\$" . $Red_Price;
$Red_Price = sprintf("%9s\n", $Red_Price);
if ($Red == "Yes"
$Order_Red="
Red:
Traditionals: $Red_Traditional
Non-Traditionals: $Red_Non_Traditional
--------------------
Price For Red Wreaths: $Red_Price
Shipping For Red Wreaths: $Red_Shipping
Subtotal: $Red_Subtotal
";
} else {$Order_Red="";}
$Blue_Shipping = ($Blue_Traditional+$Blue_Non_Traditional)*$Wreath_Shipping;
$Blue_Price = ($Blue_Traditional+$Blue_Non_Traditional)*$Wreath_Price;
$Blue_Subtotal_Raw_Data = $Blue_Price + $Blue_Shipping;
$Blue_Subtotal = sprintf("%.2f",$Blue_Subtotal_Raw_Data);
1 while $Blue_Subtotal =~ s/^(\d+)(\d{3})/$1,$2/;
$Blue_Subtotal = "\$" . $Blue_Subtotal;
$Blue_Subtotal = sprintf("%9s\n", $Blue_Subtotal);
$Blue_Shipping = sprintf("%.2f",$Blue_Shipping);
1 while $Blue_Shipping =~ s/^(\d+)(\d{3})/$1,$2/;
$Blue_Shipping = "\$" . $Blue_Shipping;
$Blue_Shipping = sprintf("%9s\n", $Blue_Shipping);
$Blue_Price = sprintf("%.2f",$Blue_Price);
1 while $Blue_Price =~ s/^(\d+)(\d{3})/$1,$2/;
$Blue_Price = "\$" . $Blue_Price;
$Blue_Price = sprintf("%9s\n", $Blue_Price);
if ($Blue == "Yes"
$Order_Blue="
Blue:
Traditionals: $Blue_Traditional
Non-Traditionals: $Blue_Non_Traditional
--------------------
Price For Blue Wreaths: $Blue_Price
Shipping For Blue Wreaths: $Blue_Shipping
Subtotal: $Blue_Subtotal
";
} else {$Order_Blue="";}
$Mauve_Shipping = ($Mauve_Traditional+$Mauve_Non_Traditional)*$Wreath_Shipping;
$Mauve_Price = ($Mauve_Traditional+$Mauve_Non_Traditional)*$Wreath_Price;
$Mauve_Subtotal_Raw_Data = $Mauve_Price + $Mauve_Shipping;
$Mauve_Subtotal = sprintf("%.2f",$Mauve_Subtotal_Raw_Data);
1 while $Mauve_Subtotal =~ s/^(\d+)(\d{3})/$1,$2/;
$Mauve_Subtotal = "\$" . $Mauve_Subtotal;
$Mauve_Subtotal = sprintf("%9s\n", $Mauve_Subtotal);
$Mauve_Shipping = sprintf("%.2f",$Mauve_Shipping);
1 while $Mauve_Shipping =~ s/^(\d+)(\d{3})/$1,$2/;
$Mauve_Shipping = "\$" . $Mauve_Shipping;
$Mauve_Shipping = sprintf("%9s\n", $Mauve_Shipping);
$Mauve_Price = sprintf("%.2f",$Mauve_Price);
1 while $Mauve_Price =~ s/^(\d+)(\d{3})/$1,$2/;
$Mauve_Price = "\$" . $Mauve_Price;
$Mauve_Price = sprintf("%9s\n", $Mauve_Price);
if ($Mauve == "Yes"
$Order_Mauve="
Mauve:
Traditionals: $Mauve_Traditional
Non-Traditionals: $Mauve_Non_Traditional
--------------------
Price For Mauve Wreaths: $Mauve_Price
Shipping For Mauve Wreaths: $Mauve_Shipping
Subtotal: $Mauve_Subtotal
";
} else {$Order_Mauve="";}
$Teaser_Price = $Amount_of_Teasel_Teasers * $Kissingball_Price;
$Teaser_Shipping = $Amount_of_Teasel_Teasers * $Kissingball_Shipping;
$Teaser_Subtotal_Raw_Data = $Teaser_Price + $Teaser_Shipping;
$Teaser_Subtotal = sprintf("%.2f",$Teaser_Subtotal_Raw_Data);
1 while $Teaser_Subtotal =~ s/^(\d+)(\d{3})/$1,$2/;
$Teaser_Subtotal = "\$" . $Teaser_Subtotal;
$Teaser_Subtotal = sprintf("%9s\n", $Teaser_Subtotal);
$Teaser_Shipping = sprintf("%.2f",$Teaser_Shipping);
1 while $Teaser_Shipping =~ s/^(\d+)(\d{3})/$1,$2/;
$Teaser_Shipping = "\$" . $Teaser_Shipping;
$Teaser_Shipping = sprintf("%9s\n", $Teaser_Shipping);
$Teaser_Price = sprintf("%.2f",$Teaser_Price);
1 while $Teaser_Price =~ s/^(\d+)(\d{3})/$1,$2/;
$Teaser_Price = "\$" . $Teaser_Price;
$Teaser_Price = sprintf("%9s\n", $Teaser_Price);
if ($Teasel_Teasers == "Yes"
$Order_Teaser="
Teasel Teasers:
Quantity: $Amount_of_Teasel_Teasers
--------------------
Price For Teasle Teaser: $Teaser_Price
Shipping For Teasle Teaser: $Teaser_Shipping
Subtotal: $Teaser_Subtotal
";
} else {$Order_Teaser="";}
$Cost = $Red_Subtotal_Raw_Data+$Blue_Subtotal_Raw_Data+$Mauve_Subtotal_Raw_Data+$Teaser_Subtotal_Raw_Data;
$Cost = sprintf("%.2f",$Cost);
1 while $Cost =~ s/^(\d+)(\d{3})/$1,$2/;
$Cost = "\$" . $Cost;
$Cost = sprintf("%9s\n", $Cost);
$response_subject="Thank You For Ordering!";
$response_mail="Thank you $First_Name $Middle_Initial, $Last_Name for your order of
$Order_Red $Order_Blue $Order_Mauve $Order_Teaser
------------------------
Total Cost: $Cost
Pay Option: $Pay_Option
We will respond as quickly as we can. We hope that you will enjoy our product.
Wreath2you";
$thank_you_page="wreaths.port5.com/thankyou.html";
$error_page="wreaths.port5.com/index.html";
$custom_message="
Name: $First_Name $Middle_Initial, $Last_Name
Address:
$Address
$City, $State_or_Province $Zip_or_Postal
$Country
Phone Number: $Phone_Number
Email: $Email
--------------------------------------------------------------
Order:
$Order_Red $Order_Blue $Order_Mauve $Order_Teaser
------------------------
Total Cost: $Cost
Pay Option: $Pay_Option
--------------------------------------------------------------
Comments:
$Comments
--------------------------------------------------------------
SENDER INFO:
IP: $REMOTE_ADDR
Computer Name: $Computer_Name
Browser Type: $Browser
Page Referer: $Referrer
--------------------------------------------------------------";
print "Location: wreaths.port5.com/thankyou.html\n\n";
exit;
sub SendSubmission {
open (MAIL,"|/usr/lib/sendmail -t"
print MAIL "To: wreath2you@yahoo.com\n";
print MAIL "From: $Email\n";
print MAIL "Subject: !!FORM FILLOUT!!\n";
print MAIL "$Date\n\n";
print MAIL "E-Mail Message\n\n";
print MAIL "From: $Name\n";
print MAIL "Email: $Email\n\n";
print MAIL "$custom_message";
close (MAIL);
}
sub SendAutoReply {
open (MAIL,"|$MailProgram -t"
print MAIL "To: $Email\n";
print MAIL "From: wreath2you@yahoo.com\n";
print MAIL "Subject: Thanks for ordering!\n";
print MAIL "$\n";
print MAIL "$Date\n\n";
print MAIL "Thanks for you message!\n\n";
print MAIL "$response_mail";
close (MAIL);
}
sub GetDate {
@days = ('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
@months = ('01','02','03','04','05','06','07','08','09','10','11','12');
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$year = $year+1900;
$Date = "$days[$wday] $months[$mon]/$mday/$year";
sub CheckReferingURL {
if ($ENV{'HTTP_REFERER'}) {
if ($ENV{'HTTP_REFERER'} =~ " /i) {
$check_referer = '1';
}}
else {$check_referer = '1';}
if ($check_referer != 1) {
print "Location: exit;
}}
exit;
}