-
April 12th, 2013, 02:53 AM
#1
[RESOLVED] Confirmation email
Hi guys.
I just cannot seem to get the order confirmation sent out correctly.
It just gives me echo $OrderStr;
instead of the actual order and delivery.
If I try to add the $Delivery into the message, I get errors
Here is my code in question :
PHP Code:
$OrderStr = 'You Ordered the Following :<br> <br>';
if(isset($_POST['BreathslimQuantity']))
{
$prodAmt1 = $_POST['BreathslimPrice'] * $_POST['BreathslimQuantity'];
$prod1 = $_POST['Breathslim'];
$OrderStr = $OrderStr . $prod1 . ' at ' . $prodAmt1 . ' Each.';
}
$Delivery = $_POST['Delivery'];
if ($Delivery == 'SpeedService')
{
$SS = 70;
}
$first_name = $_POST['Name']; // required
$last_name = $_POST['Surname']; // required
$telephone = $_POST['Contact']; // not required
$address = $_POST['Address']; // required
if (isset($_POST['Email']))
{
$email = $_POST['Email'];
function died($error) {
// error code
echo "We are very sorry, but there were error(s) found with the email you submitted. ";
echo "These errors appear below.<br /><br />";
echo $error."<br /><br />";
echo "Please go back and fix these errors.<br /><br />";
die();
}
$error_message = "";
$email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
if(!preg_match($email_exp,$email)) {
$error_message .= 'The Email Address you entered does not appear to be valid.<br />';
}
if(strlen($error_message) > 0) {
died($error_message);
}
}
$Tot = $prodAmt1 + $SS;
echo 'Hi ' . $first_name . ' ' . $last_name . '<br>' . $OrderStr . '<p>Delivery Method : ' . $Delivery;
// multiple recipients
$to = 'orders@thenewme.co.za' . ', '; // note the comma
$to .= $email;
// subject
$subject = 'BreathSlim® Order Confirmation';
// message
$message = '
<html>
<head>
<title>BreathSlim® Order Confirmation</title>
</head>
<body>
echo $OrderStr;
</body>
</html>
';
// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// Mail it
mail($to, $subject, $message, $headers);
?>
Thank you for contacting us. We will be in touch with you very soon.
</p>
</div>
</body>
</html>
can anyone help?
-
April 15th, 2013, 11:05 AM
#2
Re: Confirmation email
PHP Code:
$message = ' <html> <head> <title>BreathSlim® Order Confirmation</title> </head> <body>' . $OrderStr . '</body> </html> ';
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
-
April 16th, 2013, 07:38 AM
#3
Re: Confirmation email
<facepalm>Duh Hannes! </facepalm>Thanks Paul! I knew it was something very small!
I did notice one thing however : My delivery method does not get picked up by php.
I do this on my form :
PHP Code:
<td colspan = "4"><p style="color: #FFFFFF; font-family:Arial, Helvetica, sans-serif">Delivery :<br> SpeedService (Counter to Counter) – R70 <input type="radio" name = "Delivery" value "SpeedService"></p> <p>UTI Courier Fee (Door to Door Delivery) – R75<input type="radio" name = "Delivery" value "UTI"></p> <p>Delivery charges might increase depending on the weight of your parcel(s)</p></td> </tr>
Then in my PHP file I attempt to do this :
PHP Code:
$Delivery = (string)$_POST['Delivery']; if ($Delivery == 'SpeedService') { $SS = 70; } else if ($Delivery == 'UTI') { $UTI = 75; }
echo 'Hi ' . $first_name . ' ' . $last_name . '<br>' . $OrderStr . '<p>Delivery Method : ' . $Delivery . '</p><p>Total : ' . $Tot . $Bank;
My Delivery prints nothing at all. Can you help?
-
April 18th, 2013, 01:05 AM
#4
Re: Confirmation email
OK, it's official. I'm stupid and I suck at php!
I forgot the = in my HTML code. It should be :
PHP Code:
<p>Delivery :<br> SpeedService (Counter to Counter) – R70 <input type="radio" name = "Delivery" value = "SpeedService"></p>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|