Hi guys, my boyfriend's having a lot of trouble with a form script. The script (mail) should be sending two emails, one "Thank you" mail for the client, and one "Information" mail for himself. The problem is that it's sending four emails, two "Thank you" mails for the client, except one is empty, and two "Information" mails for himself, and again, one of them is empty. Here's the part of the script which I think contains the problem:
PHP Code:
$query_prop = "SELECT pname from property where id_prop='$id_prop'";
$res_prop = $system->Execute($query_prop) or die ($system->ErrorMsg());
$propname = $res_prop->Fields('pname');
$para = "email1@host.com";
$asunto = "Reservation in process";
$nombre = "Some Realtors";
$decorreo = "email2@host.com";
$mensaje = "<p>Thanks</p><p>Dear " . $fname . " " . $lname . "</p><p>Thank you for your inquiry regarding " . $propname . "</p><p>Your information has been received and a Some Realtor Representative will contact the property owner to confirm availability and rates. You can normally expect to receive a response within 24 hours from one of our agent to complete the reservation.</p><p>If you have any questions you can also contact us by phone at one of these numbers:</p><p>US number: 1 (415) 691-4351<br>Mexico Office: (322) 221-0286 & 87</p>";
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: Some Realtors <email2@host.com>\r\n";
$para2 = "email1@host.com";
$asunto2 = "Reservation Request";
$nombre2 = $fname . " " . $lname;
$decorreo2 = $email;
$headers2 = "MIME-Version: 1.0\r\n";
$headers2 .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers2 .= "From: " . $nombre2 . " <" . $decorreo2 . ">\r\n";
$mensaje2 = "A new reservation request has been placed, please verify the information and confirm to the client. The guest information is: <br> Name: " . $fname . " " . $lname . " <br> Other names: " . $anames . " <br> Mailing adress: " . $madress . ", " . $madress2 . " <br> City: " . $city . " <br> Zip Code: " . $zcode . " <br> Country: " . $country . " <br> Phone: " . $phone . " <br> Email: " . $email . " <br> Property name: " . $propname . " <br> Arrival: " . $arrival . " <br> Depart: " . $depart . " <br> Nights: " . $nights . " <br> Adults: " . $adults . " <br> Child(ren): " . $child . "<br> Arrival Airline: " . $airl1 . "<br> Flight: " . $flight1 . "<br> Time: " . $time1. "<br> Departure Airline: " . $airl2 . "<br> Flight: " . $flight2 . "<br> Time: " . $time2 . "<br> VIP: " . $vips . "<br> Comments: " . $comments;
if ($enviado == "No") {
mail($para2, $asunto2, $mensaje2, $headers2);
mail($para, $asunto, $mensaje, $headers);
$enviado = "ok";
}
Any help would be tremendously appreciated.
|