开发者

question regarding email

In $_SESSION['cart'] there are multiple records with table. But when I trying to send email. Im only getting one table data. Please help me

session_start();
$message = array();
foreach($_SESSION['cart'] as $key => $value) 
{
    $message ="<table>
                <tr>
                    <td>Product Image</td>
                    <td><a href=".$value['txturl'].">
                        <img width =150  开发者_运维知识库src=".$value['product_image']." /></a></td
                </tr>
                 <tr>
                    <td>Product Name</td>
                    <td>".$value['product_name']."</td>
                </tr>
                <tr>
                    <td>Product Price</td>
                    <td>".$value['product_price']."</td>
                </tr>
                <tr>
                    <td>Shop Name</td>
                    <td>".$value['shop_name']."</td>
                </tr>
                <tr>
                    <td>Quantity</td>
                    <td>".$value['Quantity']."</td>
                </tr>
                <tr>
                    <td>Color</td>
                    <td>".$value['color']."</td>
                </tr>
                <tr>
                    <td>Product_Type</td>
                    <td>".$value['Product_Type']."</td>
                </tr>
                <tr>
                    <td>Remarks</td>
                    <td>".$value['Remarks']."</td>
                </tr>
                <tr>
                    <td>Final Price</td>
                    <td>".$value['final_price']."</td>
                </tr>

                </table>"; 
}
    $to = "";
$subject = "Order Details";

$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

$from = "";
$headers .= 'From: Admin - Order Details <admin.com>' . "\r\n";
mail($to,$subject,$message,$headers);


$message should be a string.

Start with:

$message = '';

And then each time through your loop, append the html:

$message .= " .... ";


change

$message =

to

$message .=

otherwise you just overwrite on every loop


try to use

$message =' ';

and inside for loop use $message .='<table>.......</table';

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜