ive setup the subject, from and content type for the mail() option first outside of the loop then i start pulling info from a database to use in the loop. To each of the email addresses it uses the wrong information. it keeps repeating the name of the first person pulled from the database even though i unset the array
Code: Select all
<?php
$messy= $_POST['emailmessage']
$subject = "$emailertopic";
$headers = "From: le1248 <$admyaddy>\r\nReply-To:".$admyaddy."\r\n";
$headers .= "Content-Type: text/html; charset=\"UTF-8\"\r\nContent-Transfer-Encoding: 8bit";
$result = mysql_query("SELECT email, name FROM person ORDER BY id ASC", $dbConn);
while ($resultf= mysql_fetch_array($result , MYSQL_ASSOC)) {
$name= $resultf['name '];
$to= $resultf['email'];
$chrpfrom = array("**name**","\n");
$chrpto = array($name,"<br />");
$chrp = array_combine($chrpfrom, $chrpto);
$messy = strtr($messy, $chrp);
unset($chrpfrom);unset($chrpto);unset($chrp );
ob_start();?>
This is the message<br>
_________________<br>
<?=$messy?>
_________________<br>
<?php
$message = ob_get_clean();
mail( $to, $subject, $message, $headers );
}