Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 04-09-2012, 03:43 PM   PM User | #1
calsta
New Coder

 
Join Date: Apr 2012
Posts: 67
Thanks: 12
Thanked 1 Time in 1 Post
calsta is an unknown quantity at this point
i need help making a form send to two emails

how do i make this send to 2 emails instead of just 1?
<?php

/* SUBJECT AND EMAIL*/

$emailSubject = 'order';
$webMaster = 'here-is-email1@example.com';

/* Gathering Data Variables */
$company = $_POST['company'];
$order = $_POST['order'];
$email = $_POST['Email'];
$accountnumber = $_POST['1'];


$body = <<<EOD
<br>hr<br>
Email: $email <br>
Account number: $accountnumber <br>
Company: $company <br>
Order: $order <br>
EOD;

$headers = "From: $email\r\n";
$headers .= "Content-type: text/html\r\n";
$success = mail($webMaster, $emailSubject, $body, $headers);

/*results rendered as HTML */
$theResult = <<<EOD
<html>
<head>
<title>Submitted</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
background-color: #000000;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
font-style: normal;
line-height: normal;
font-weight: normal;
color: #666666;
text-decoration: none;
}
#Layer1 { position:absolute;
width:112px;
height:73px;
z-index:1;
left: 73px;
top: 18px;
}
.style1 {color: #FFFFFF}
-->
</style>
</head>

<div id="Layer1"><img src="http://images.thomann.de/pics/herstlogos/gewa.gif" width="154" height="89" alt="Logo" /></div>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<div>
<div align="left">
<p class="style1">Thank you for your order! Your goods will be with you very soon.</p>
</div>
</div>
</body>
</html>
EOD;
echo "$theResult";
?>
calsta is offline   Reply With Quote
Old 04-09-2012, 09:25 PM   PM User | #2
dan-dan
Regular Coder

 
dan-dan's Avatar
 
Join Date: Aug 2009
Location: England
Posts: 483
Thanks: 22
Thanked 79 Times in 78 Posts
dan-dan is on a distinguished road
Two to the same address or different addresses?
dan-dan is offline   Reply With Quote
Old 04-10-2012, 10:16 AM   PM User | #3
Major Payne
Regular Coder

 
Join Date: Aug 2005
Location: MS
Posts: 745
Thanks: 7
Thanked 65 Times in 63 Posts
Major Payne is an unknown quantity at this point
How to submit a form to multiple email addresses: http://webdesign.about.com/b/2008/01...-addresses.htm
__________________
☠ ☠RON☠ ☠
Major Payne is offline   Reply With Quote
Old 04-10-2012, 12:50 PM   PM User | #4
calsta
New Coder

 
Join Date: Apr 2012
Posts: 67
Thanks: 12
Thanked 1 Time in 1 Post
calsta is an unknown quantity at this point
hi guys thanks but it still doesn't work can any1 try to solve this please, here is the code again
<?php

/* SUBJECT AND EMAIL*/

$emailSubject = 'order';
$webMaster = 'example@123.com';

/* Gathering Data Variables */
$company = $_POST['company'];
$order = $_POST['order'];
$email = $_POST['Email'];
$accountnumber = $_POST['1'];
$purchaseordernumber = $_POST['2'];


$body = <<<EOD
<br><hr><br>
Email: $email <br>
Account number: $accountnumber <br>
Company: $company <br>
Purchase order number: $purchaseordernumber <br>
Order: $order <br>
EOD;

$headers = "From: $email\r\n";
$headers .= "Content-type: text/html\r\n";
$success = mail($webMaster, $emailSubject, $body, $headers);

/*results rendered as HTML */
$theResult = <<<EOD
<html>
<head>
<title>Submitted</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
background-color: #000000;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
font-style: normal;
line-height: normal;
font-weight: normal;
color: #666666;
text-decoration: none;
}
#Layer1 { position:absolute;
width:112px;
height:73px;
z-index:1;
left: 73px;
top: 18px;
}
.style1 {color: #FFFFFF}
-->
</style>
</head>

<div id="Layer1"><img src="http://images.thomann.de/pics/herstlogos/gewa.gif" width="154" height="89" alt="Logo" /></div>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<div>
<div align="left">
<p class="style1">Thank you for your order! Your goods will be with you very soon.</p>
</div>
</div>
</body>
</html>
EOD;
echo "$theResult";
?>
calsta is offline   Reply With Quote
Old 04-10-2012, 01:37 PM   PM User | #5
SB65
Senior Coder

 
Join Date: Feb 2009
Location: West Yorkshire
Posts: 2,812
Thanks: 9
Thanked 681 Times in 675 Posts
SB65 will become famous soon enoughSB65 will become famous soon enough
What was the problem with the code I posted in your other thread? As I said there, your PHP is not formed correctly to send the mail.

If you're trying to send two different email messages then you can just add another mail command:

Code:
$success = mail($webMaster, $emailSubject, $body, $headers); 
mail($anotherEmail,$emailSubject,$differentText, $headers);

Last edited by SB65; 04-10-2012 at 01:43 PM..
SB65 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:31 PM.


Advertisement
Log in to turn off these ads.