Jump to content

Confirmation email


Go to solution Solved by jazzman1,

Recommended Posts

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 :

$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?

Link to comment
https://forums.phpfreaks.com/topic/276856-confirmation-email/
Share on other sites

  • Solution

Put your emails into an array and just implode them.

 

Example:

// multiple recipients
$to = array('examle1@example.com','example2@example.com','example3@example.com');


// send emails
mail(implode(',', $to), $subject, $message, $headers);

Edited by jazzman1
Link to comment
https://forums.phpfreaks.com/topic/276856-confirmation-email/#findComment-1424357
Share on other sites

Thanks

 

I now have a problem with my radio buttons not sending info to my php file

 

I do this in my order page :

<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 I try to use it in php like this :

 if (isset($_POST['Delivery']))
 {
	$Delivery = $_POST['Delivery'];
	if ($Delivery == 'SpeedService')
		{
		$SS = 70;
		}
	else if ($Delivery == 'UTI')
		{
		$UTI = 75;
	}
 }
$Tot = $prodTot1 + $prodTot2 + $prodTot3 + $prodTot4 + $prodTot5 + $prodTot6 + $prodTot7 + $prodTot8 + $prodTot9 + $prodTot10 + $prodTot11 + $prodTot12 + $prodTot13 + $prodTot14 + $prodTot15 + $SS + $UTI;

But it doesn't pick up anything.

 

What am i doing wrong?

Link to comment
https://forums.phpfreaks.com/topic/276856-confirmation-email/#findComment-1425326
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.