I am using a shopping cart which combines multiple values in a single field. With some help, I've figured out how to explode the values to update the database. I can't figure out how to list all the products in a simple table for an HTML email.
Here's where I've exploded the values early in the script:
/ breaks the string into an array of products
$products = explode("~", $cart);
$i = 0;
// breaks each product string into its own array
foreach($products as $var => $val){
$product[$i] = explode(":", $val);
$id = $product[$i][0];
$qty = $product[$i][1];..
$i++;
}
Here's the part of the code which isn't working. This iteration does not return any rows of data. I've tried a variety of things none of which have worked. If I use the simple variables declared above, I only get one row of data. How do I loop through all the results. Do I need to explode the value again?
Here's my latest effort:
<table cellspacing=\"2\" cellpadding=\"2\" width=\"350\" bgcolor=\"#ffffff\" border=\"1\">
<tr valign=\"top\">
<td><b>Product</b></td>
<td><b>Quantity</b></td>
<td><b>Price</b></td> </tr>";
$i = 0;
$message .= "<td>";
$product[$i][0];
$message .= "</td>
<td>";
$product[$i][1];
$message .= "</td>
<td>";
$product[$i][2];
$message .= "</td>";
$i++;