Hi guys,
i am trying to send out this email by using mail function.. i can receive the email that i sent out but there is no sender information displayed.. in other words, the header for From doesn’t seem to work.. did i use the from header in the wrong way ??
besides of that, one of the email i received contains item and price per item info but another one (confirmation) is not working at all.. actually the code used to send two emails are the same… i just change the variables by adding ‘1’… is it the variable scope prob ??? is that so, what can i do to make it right ?
in the confirmation email, the email and the phone value i fetch from the db are not shown in the email as well,, why is that so ???
my code:
<?
include_once “include/db.php”;
global $totalCost;
$result = mysql_query(“select* from cart inner join items on cart.itemId = items.itemId where cart.cookieId = ‘”.GetCartId().”‘ order by items.itemName asc”) or die (mysql_error());
$result2 = mysql_query(“SELECT * FROM info WHERE `username
$row = mysql_fetch_array($result2);
$to = “{$row[’email’]}rn”;
$from= “From : $name < $email >rn”;
$subject =”$name.com – online shopping orderrn”;
while($row = mysql_fetch_array($result)) {
$totalCost += ($row[“qty”] * $row[“itemPrice”]);
$contents .=”Quantity: {$row[‘qty’]}n”;
$contents .=”Item: {$row[‘itemName’]}n”;
$contents .=”Price per item: RM”;
$contents .= number_format($row[‘itemPrice’], 2,’.’, ‘.’) . “nn”;
}
$contents .=”Total amount: USD {$totalCost}n”;
mail($to,$subject,$contents,$from);
$to1 = “$emailrn”;
$from1= “From : $name.com < {$row[’email’]} >rn”;
$subject1 =”$name.com – Order ConfiUSDationrn”;
$contents1 =”
Please check ur order and reply to confirm. You may contact us at:”;
$contents1 .= $status[’email’];
$contents1 .= ” or phone”;
$contents1 .= $status[‘phone’];
$contents1 .=”
==================
“;
//$totalCost = “0”;
while($row = mysql_fetch_array($result)) {
$totalCost += ($row[“qty”] * $row[“itemPrice”]);
$contents1 .=”Quantity: {$row[‘qty’]}n”;
$contents1 .=”Item: {$row[‘itemName’]}n”;
$contents1 .=”Price per item: USD”;
$contents1 .= number_foUSDat($row[‘itemPrice’], 2,’.’, ‘.’) . “nn”;
}
$contents1 .=”Total amount: USD {$totalCost}n”;
mail($to1,$subject1,$contents1,$from1);
?>
please advise..