title: How to append 2 pieces of PHP code, when sending an array of data?
body: <p>I have sessions variables, in which are stored cart data, and I want to send those via email. This is the loop to write all cart data.</p>
  
  <pre><code>foreach($_SESSION["shopping_cart"] as $keys =&gt; $values)
              {
            ?&gt;
            &lt;tr&gt;
              &lt;td&gt;&lt;?php echo $values["item_name"]; ?&gt;&lt;/td&gt;
              &lt;td&gt;&lt;?php echo $values["item_quantity"]; ?&gt;&lt;/td&gt;
              &lt;td&gt;€ &lt;?php echo $values["item_price"]; ?&gt;&lt;/td&gt;
              &lt;td&gt;€ &lt;?php echo number_format($values["item_quantity"] * $values["item_price"], 2);?&gt;&lt;/td&gt;
              &lt;td&gt;&lt;a href="cart.php?action=delete&amp;id=&lt;?php echo $values["item_id"]; ?&gt;"&gt;&lt;span class="text-danger"&gt;Vymazať&lt;/span&gt;&lt;/a&gt;&lt;/td&gt;
            &lt;/tr&gt;
            &lt;?php
                $total = $total + ($values["item_quantity"] * $values["item_price"]);
              }
  </code></pre>
  
  <p>This is my code to send email and I want to put in there the cart data...</p>
  
  <pre><code>require 'phpmailer/PHPMailerAutoload.php';
                      $mail = new PHPMailer(true);
  
                      $mail-&gt;CharSet = 'UTF-8';
                      $mail-&gt;Host='smtp.gmail.com';
                      $mail-&gt;Port=995;
                      $mail-&gt;SMTPAuth=true;
                      $mail-&gt;SMTPSecure='ssl';
                      $mail-&gt;Username='deelakeObjednavky@gmail.com';
                      $mail-&gt;Password='password';
  
                      $mail-&gt;setFrom($_POST['email'],"Deelake - objednávka");
                      $mail-&gt;addAddress('deelakeObjednavky@gmail.com');
                      $mail-&gt;addReplyTo($_POST['email'],$_POST['meno']);
  
                      $mail-&gt;isHTML(true);
                      $mail-&gt;Subject = 'Vyplnený kontaktný formulár:Objednávka';
                      $mail-&gt;Body='&lt;h1 align=center&gt;New ORDER &lt;/h1&gt;';
  
                      if (!$mail-&gt;send()) {
                          $result="Email error.";
                      }
                      else{
                          $result="Email success.";
                      }
  </code></pre>