title: Display array contents in mail - phpmailer
body: <p>So i have </p>
  
  <p>mail.php -> sends mail</p>
  
  <p>index.php -> mail body structure</p>
  
  <p>I want to send array values from mail.php to index.php and iterate the array contents in html.</p>
  
  <p>mail.php</p>
  
  <pre><code>use PHPMailer\PHPMailer\PHPMailer;
  use PHPMailer\PHPMailer\Exception;
  
  require 'vendor/autoload.php'; 
  require '../inc/database.php';
  
  $query = "  query " ;
  
  $result = mysqli_query($link,$query);
  if(mysqli_num_rows($result))
  {
      while($row = mysqli_fetch_assoc($result))
      {
          $arr[]=$row;
          print_r($arr);
      }
  } 
  // $arr returns Array ( [0] =&gt; Array ( [val1] =&gt; 1 [val2] =&gt; 2 ) [1] =&gt; Array ( [val1] =&gt; a [val2] =&gt; b) 
  
  ....
  mail-&gt;MsgHTML(file_get_contents("index.php")); // Body of my mail 
  ...
  ?&gt;
  </code></pre>
  
  <p>index.php</p>
  
  <pre><code>...
  &lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;
   &lt;tr&gt;
     &lt;td style="padding: 15px 0 0 0; color: #153643; font-family: Arial, sans-serif; font-size: 16px; line-height: 20px;"&gt;
        // Display my array contents here 
     &lt;/td&gt;
    &lt;/tr&gt;                                                            
  &lt;/table&gt;
  ...
  </code></pre>
  
  <p>i want my output to look like:</p>
  
  <p>1:2</p>
  
  <p>a:b</p>
  
  <p>How can this be achieved ? How can i pass array variables from mail.php page to index.php page and loop the array value there?</p>