Hi everyone,

I have written the list about this problem before and have yet to find a solution.  
After several hours of debugging and research through list archives, my husband and I 
had concluded that the errors were due to the version of PHP being used by the server, 
which was very outdated.  We asked the client to update her version of PHP, which she 
did.  The server is now using PHP 4.3.0 and globals are on (on the old version, they 
were off).

We modified our script for globals on and now we are getting all new errors.  To name 
a few, when the client's e-mail address is omitted, a message should appear, stating 
"Please go back and enter the customer's e-mail address!", but instead, it states 
"Please go back and enter the customer's request type!" which is a message that should 
appear when the type is omitted.  Also, when no parts are indicated, a message should 
appear, to the effect of "Please go back and enter a part" but instead, the program 
goes ahead and sends an empty e-mail to the customer.  There are several other errors, 
basically, none of the commands work properly.

My husband is convinced that there is something wrong with the script's logic, but I 
certainly can't find it.  Can anyone see anything wrong with this script?  Here it is:

<?php
//Build email Body based on customer request
IF (isset($_POST['custemail'])) {
IF ($_POST['request_type']=="Service_Advice") {
$body = "Thank you for your request for information. Because it is difficult to answer 
your question via email, the best advice we can offer you is to call your auto 
technician for more information.<BR><BR>Or, for the best service on your Volvo, you 
may want to bring it in for a proper diagnosis to a Volvo specialist. If you are close 
to one of our Swedish Engineering locations call us for an appointment.<BR><BR>You can 
find our Service Department phone numbers and locations on the following page: <A 
href='http://swedishengineering.com/service.html'>http://swedishengineering.com/service.html</A><BR>(If
 your email client doesn't allow you to click on the link above, just copy and paste 
into your browser)<BR><BR>";
$body .= $_POST['comments'];
$body .= "<BR><BR>Thank you,<BR><BR>Swedish Engineering Staff";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: [EMAIL PROTECTED]";
$headers .= "To: ".$_POST['custemail']."\r\n";

mail($_POST['custemail'], "Your Service Advice Request", $body, $headers);

header("Location:index.html");
}
ELSE IF ($_POST['request_type']=="Parts_Advice") {
$body = "Thank you for your request for information. Because it is difficult to answer 
your question via email, the best advice we can offer you is to call us for more 
information. We will do our best to help you find the right parts for your 
Volvo.<BR><BR>Please call 1-800-928-6586<BR><BR>";
$body .= $_POST['comments'];
$body .="<BR><BR>Thank you,<BR><BR>Swedish Engineering Staff";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: [EMAIL PROTECTED]";
$headers .= "To: ".$_POST['custemail']."\r\n";

mail($_POST['custemail'], "Your Parts Advice Request", $body, $headers);

header("Location:index.html");
}
ELSE IF ($_POST['request_type']=="Parts") {
IF ((!isset($_POST['part1'])) && (!isset($_POST['part2'])) && 
(!isset($_POST['part3'])) && (!isset($_POST['part4'])) && (!isset($_POST['part5'])) && 
(!isset($_POST['part6']))) {
print ("Please go back and include part information!");
}
ELSE {
$body = "Thank you for your parts request. The information you requested is listed 
below:<BR>&nbsp;<BR>";
$body .= "<TABLE>";
$body .= "<TR><TH>Part #</TH><TH>Part 
Name</TH><TH>Price</TH><TH>Shipping</TH><TH>Availability</TH></TR>";
IF (isset($_POST['part1'])){
$body .= 
"<TR><TD>$_POST['part1']</TD><TD>$_POST['partname1']</TD><TD>$_POST['price1']</TD><TD>$_POST['sprice1']</TD><TD>$_POST['avail1']</TD></TR>";
}
IF (isset($_POST['part2'])){
$body .= 
"<TR><TD>$_POST['part2']</TD><TD>$_POST['partname2']</TD><TD>$_POST['price2']</TD><TD>$_POST['sprice2']</TD><TD>$_POST['avail2']</TD></TR>";
}
IF (isset($_POST['part3'])){
$body .= 
"<TR><TD>$_POST['part3']</TD><TD>$_POST['partname3']</TD><TD>$_POST['price3']</TD><TD>$_POST['sprice3']</TD><TD>$_POST['avail3']</TD></TR>";
}
IF (isset($_POST['part4'])){
$body .= 
"<TR><TD>$_POST['part4']</TD><TD>$_POST['partname4']</TD><TD>$_POST['price4']</TD><TD>$_POST['sprice4']</TD><TD>$_POST['avail4']</TD></TR>";
}
IF (isset($_POST['part5'])){
$body .= 
"<TR><TD>$_POST['part5']</TD><TD>$_POST['partname5']</TD><TD>$_POST['price5']</TD><TD>$_POST['sprice5']</TD><TD>$_POST['avail5']</TD></TR>";
}
IF (isset($_POST['part6'])){
$body .= 
"<TR><TD>$_POST['part6']</TD><TD>$_POST['partname6']</TD><TD>$_POST['price6']</TD><TD>$_POST['sprice6']</TD><TD>$_POST['avail6']</TD></TR>";
$body .= "</TABLE>";
$body .= "Please call our service center, if you need to reserve them for pick up, or 
to place an order to have them shipped.<BR>";
$body .= "Our Service departments are located on the following page:<BR>&nbsp;<BR>";
$body .= "<a 
href='http://swedishengineering.com/service.html'>http://swedishengineering.com/service.html</a><BR>&nbsp;<BR>";
$body .= "(If your email client doesn't allow you to click on the link above, just 
copy and paste into your browser)<BR><BR>";
$body .= $_POST['comments'];
$body .= "<BR><BR>Thank you,<BR><BR>Swedish Engineering Staff";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: [EMAIL PROTECTED]";
$headers .= "To: ".$_POST['custemail']."\r\n";

mail($_POST['custemail'], "Your Parts Request", $body, $headers);

header("Location:index.html");
}
}
}
ELSE {
print ("Please go back and enter the customer's request type!");
}
} 
ELSE {
print ("Please go back and enter the customer's email address!");
}
?>

The form that uses this script is located at: 
http://www.swedishengineering.com/requestresponse.html
Thanks to anyone who can help me out with this!  We have been banging our heads on our 
desks for a really long time with what is supposed to be just a simple script.  We are 
beginning to think that the server is possessed. LOL

Julie Williams


Reply via email to