OK,
here it is what did I do wrong??
PLEASE HELP!!
sub send_me {
# Open The Mail Program
local($totalquant,$totalprice,$totalweight) = 0;
open (MAIL, "|$mailprog -t -f") || print "Can't start mail program";
print MAIL "To:
[email protected],$FORM{'email'}n";
print MAIL "From: $FORM{'email'}n";
print MAIL "Subject: $FORM{'subject'}nn";
print MAIL "-----------------------------------------------------------------n";
print MAIL " Thank you for ordering from The Store! nn";
print MAIL " Your order information appears below. If you need n";
print MAIL " to get in touch with us about your order, send an email n";
print MAIL " message to
[email protected] nn";
print MAIL " --.com Customer Service n";
print MAIL "------------------------------------------------------------------n";
print MAIL "This is a Online Process.n";
print MAIL "This form was submitted by";
print MAIL " $FORM{'last_name'} $FORM{'last_name'} ($FORM{'email'})n";
print MAIL "on $daten";
print MAIL "----------------------------------------------------------------n";
print MAIL "Buyer info:nn";
print MAIL "Order Number : $index n";
print MAIL "Name: $FORM{'first_name'} $FORM{'last_name'}n";
print MAIL "Address: $FORM{'address'}n";
print MAIL "$FORM{'city'}, $FORM{'state'} ";
print MAIL "$FORM{'zip'}n";
print MAIL "Phone: $FORM{'home_phone'}n";
print MAIL "Credit Card: removen";
print MAIL "Card Number: removen";
print MAIL "Expires: removen";
print MAIL "----------------------------------------------------------------n";
print MAIL "Recipients info:nn";
print MAIL "Name: $FORM{'rfirst_name'}n";
print MAIL "Address: $FORM{'raddress'}n";
print MAIL "$FORM{'rcity'}, $FORM{'rstate'} ";
print MAIL "$FORM{'rzip'}n";
print MAIL "Phone: $FORM{'rhome_phone'}n";
print MAIL "----------------------------------------------------------------nn";
print MAIL "Remote Host: $userhostn";
print MAIL "Buyer Agent: $useragentn";
print MAIL "----------------------------------------------------------------nn";
print MAIL "The purchase is:nn";
print MAIL sprintf "%-14s", "Item ID";
print MAIL sprintf "%-23s", "Item Name";
print MAIL sprintf "%14s", "Item Price";
print MAIL sprintf "%14s", "Quantity";
print MAIL sprintf "%14s", "Totals";
print MAIL "n";
print MAIL "--------------------------------------------------------------------------------n";
for ($i=1;$i<$SIZE;$i++) {
$_ = $LINES[$i];
($itemname, $itemprice, $itemquant, $weight, $itemid) = split(/|/,$_);
$tmpprice = $itemprice*$itemquant;
$_ = $tmpprice;
if (/./) {
($left,$right) = split(/./,$tmpprice);
if (length($right) == 0) {
$tmpprice = $tmpprice . "00";
}
elsif (length($right) == 1) { $tmpprice = $tmpprice . "0"; }
}
else { $tmpprice = $tmpprice . ".00"; }
$totalprice=$totalprice + $tmpprice;
$totalquant=$totalquant + $itemquant;
$totalweight = $totalweight + $weight;
print MAIL sprintf "%-14.14s", "$itemid";
print MAIL sprintf "%-24.24s", $itemname;
print MAIL sprintf "%13.13s", "$$itemprice";
print MAIL sprintf "%10.10s", $itemquant;
print MAIL sprintf "%18.18s", "$$tmpprice";
print MAIL "n";
}#End of for loop
print MAIL "--------------------------------------------------------------------------------n";
print MAIL "Subtotal:";
$_ = $totalprice;
if (/./) {
($left,$right) = split(/./,$totalprice);
if (length($right) == 0) {
$totalprice = $totalprice . "00";
}
elsif (length($right) == 1) { $totalprice = $totalprice . "0"; }
}
else { $totalprice = $totalprice . ".00"; }
print MAIL sprintf "%71s", "$$totalpricen";
#Print shipping from form
$shipamt = "3.50";
print MAIL "Shipping:";
print MAIL sprintf "%71s", "$$shipamtn";
#end of hack
if ($tax){
$tax = $totalprice * $tax;
$_ = $tax;
($tleft, $tright) = split(/./, $tax);
$tright = substr($tright, 0, 2);
$_ = $totalprice;
($left,$right) = split(/./,$totalprice);
if (length($right) == 0 ){
$right = "00";
} elsif (length($right) == 1 ){
$right = $right . "0";
}
$left = $tleft + $left;
$right = $tright + $right;
if ($right > 99) {
$right = $right - 100;
$left = $left + 1;
}
$totalprice = $left.".".$right;
$tax = $tleft . "." . $tright;
print MAIL "Tax:";
print MAIL sprintf "%76s" , "$$taxn";
$tax = 0.0825;
}
#Print total price from form
#$totalprice = $FORM {'total'};
$totalprice = int($totalprice * (10 ** 2) + .5) / (10 ** 2);
$_ = $totalprice;
($left,$right) = split(/./,$totalprice);
if (length($right) == 0 ){
$right = "00";
} elsif (length($right) == 1 ){
$right = $right . "0";
}
$left = 3 + $left;
$right = 50 + $right;
if ($right > 99) {
$right = $right - 100;
$left = $left + 1;
}
$totalprice = $left.".".$right;
$_ = $totalprice;
if (/./) {
($left,$right) = split(/./,$totalprice);
if (length($right) == 0) {
$totalprice = $totalprice . "00";
}
elsif (length($right) == 1) { $totalprice = $totalprice . "0"; }
}
else { $totalprice = $totalprice . ".00"; }
print MAIL "Total Price:";
print MAIL sprintf "%70s" , "$$totalpricennn";
# end of print
if ($CONFIG{'sort'} eq 'alphabetic') {
foreach $key (sort keys %FORM) {
# Print the name and value pairs in FORM array to mail.
print MAIL "$key: $FORM{$key}nn";
}
}
elsif ($CONFIG{'sort'} ne 'alphabetic') {
$CONFIG{'sort'} =~ s/order://;
@sorted_fields = split(/,/, $CONFIG{'sort'});
foreach $sorted_field (@sorted_fields) {
# Print the name and value pairs in FORM array to mail.
if ($FORM{$sorted_field}) {
print MAIL "$sorted_field: $FORM{$sorted_field}nn";
}
}
}
else {
foreach $key (keys %FORM) {
# Print the name and value pairs in FORM array to html.
print MAIL "$key: $FORM{$key}nn";
}
}
$totalprice = 0;
open (REFFILE,"$reffile") || print "Content-type: text/htmlnn Can't Open $reffile(r): $!n";
@LINES=
;
close(REFFILE);
$SIZE=@LINES;
print MAIL "----------------------------------------------------------------------------------n";
print MAIL " Will ship using US First Class (please allow 5 -10 business days) n";
print MAIL "----------------------------------------------------------------------------------n";
print MAIL " Note: These charges will appear as on your statement n";
print MAIL "----------------------------------------------------------------------------------n";
close (MAIL);
}
Had to remove personal/ company info.
[ February 20, 2001: Message edited by: RoadWarrior ]
[ February 20, 2001: Message edited by: RoadWarrior ]