-2

Hi there so i'm doing a shopping cart and I do print an array with foreach on my website, after that the customer need to fill in their shipping information and send the form. But when I want to send the for each through email with php mail I keep getting "Parse error: syntax error, unexpected 'foreach' (T_FOREACH) in end.php on line 189" Any help on this one?

Code : http://pastebin.com/mv0QY4tZ - Related line in between 169-310

Zonta
  • 3
  • 4

1 Answers1

0

You cannot echo into a string your assigning($message02). Close the string out first. Then run your foreach that creates a combines string. Then combine the strings at end all together.

on line 190. ';

 </div>';

$message02partb = "";
foreach( $desc as $j => $code ) {
    if ($qte[$j] <= 9) {
        $spacer[$j] = "&nbsp;&nbsp;";
    }
   $message02partb = $message02partb . '<div class="row row-2"><div     class="coffee-span-6 column-5">' . $code . '</div><div class="coffee-span-2">    <a href="http://www.laptopliquidation.org/lab/cart/cart.php?sub=1&id='.$j.'"><img src="./img/bilang/sup.png" /></a>&nbsp;&nbsp;&nbsp;&nbsp;' . $qte[$j] . $spacer[$j] . '&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.laptopliquidation.org/lab/cart/cart.php?add=1&id='.$j.'"><img src="./img/bilang/add.png" /></a></div><div class="coffee-span-2 column-6" style="text-align: right;">' . $price[$j] . '</div><div class="coffee-span-2"  style="text-align: right;">' . $price[$j]*$qte[$j] . '&nbsp;&nbsp;<a href="http://www.laptopliquidation.org/lab/cart/cart.php?del='.$j.'"><img src="./img/bilang/rem.png" /></a></div></div>' ;
   $stWithoutLiv += $price[$j]*$qte[$j];
   if ($multipleBB[$j] == 1 && $qte[$j] >=1 ) {
        $boxin[$j] = ceil($qte[$j]/$limitPBox[$j]);
       $numberBox[$j] += $boxin[$j];
       $priceShip[$j] += $costLiv[$j]*$boxin[$j]+($qte[$j]-    $boxin[$j])*$costLivMul[$j];
   }

}

$message02partc = '<div class="row row-3">
    <div class="coffee-span-12 column-7"></div>

Then combine them all at end near line 281

     <br /><br /><br /><br />';

$message02 = $message02.$message02partb.$message03partc';

        $headers  = 'MIME-Version: 1.0' . "\r\n";