multiple foreach loop?
| From: | Aaron Wolski | Date: | Wed, 20 Nov 2002 18:42:38 +0000 |
| Subject: | multiple foreach loop? | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-23523@lists.php.net to get a copy of this message | ||
Hi All,
Trying to create a "refer a friend" script.
User enters 10 names and email address of a friend to refer to a site.
The following code SORT of works in that it will send the email, etc..
but problem is it duplicates - sends the email out twice to the same
email address.
**CODE***
foreach($nameRefered as $referedName) {
foreach($emailRefered as $referedEmail) {
if ($referedEmail != "" && $referedName != "") {
<message body here>
/* To send HTML mail, you can set
the Content-type header. */
$headers = "Return-Path:
<$support_email>\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type:
text/html; charset=iso-8859-1\r\n";
$headers .= "From: $nameReferer
<".$emailReferer.">\r\n";
mail ($referedEmail,"Your Order on
Rinkrake.com", $message, $headers);
}
}
}
Any thoughts on why I get the email twice?
Thanks all. Much appreciated!
Aaron