0
$content="<table width='200' border='0'>
  <tr>
    <td>product name</td>
    <td>Price</td>
    <td>Qty</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>"

The above table is the content of the mail.

$pdtname , $price and $qty contains productname, product price and product quantity.

$msgSent=@mail("[email protected]",$sub,$content,$headers);

If the user select one or more products

Is it possible to multiply the second row of the table inside the $content according to the number of products selected.

2 Answers 2

1

Try this :

$content = "<table width='200' border='0'>
  <tr>
    <td>product name</td>
    <td>Price</td>
    <td>Qty</td>
  </tr>";
foreach($products as $product){
  $content .= "  <tr>
    <td>".$product['name']."</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>";
}
$content .= "</table>";
Sign up to request clarification or add additional context in comments.

Comments

0

Use foreach loop like this

$content = "<table width='200' border='0'>
<tr>
    <td>product name</td>
    <td>Price</td>
    <td>Qty</td>
</tr>";
foreach($rows as $row){
    $content .= "  <tr>
    <td><?php echo $row['product_name'];?></td>
    <td><?php echo $row['product_price'];?></td>
    <td><?php echo $row['product_quantity'];?></td>
  </tr>";
}  
$content .= "</table>";

2 Comments

Ofcourse It will add product name,price,quantity also...right..??
Can anyone tell me the better ans that listed here..??

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.