title: HTML E-Mail Template with str_replace
body: <p>I have a form, which i have programmed with AngularJs. When the user submits
  that form a php script (made with Slim) gets executed, which inserts the formdata into the DB and generates an E-Mail (PHPmailer).</p>
  
  <p>Now to the question:</p>
  
  <p>I get the structure from the email with file_get_contents from a template and replace the placeholders with str_replace.</p>
  
  <p>template:</p>
  
  <pre><code>&lt;h2&gt;User Information&lt;/h2&gt;
  
  &lt;table&gt;
    &lt;tbody&gt;
      &lt;tr&gt;&lt;th&gt;Firstname:&lt;/th&gt;&lt;td&gt;%firstname%&lt;/td&gt;&lt;/tr&gt;
      &lt;tr&gt;&lt;th&gt;Lastname:&lt;/th&gt;&lt;td&gt;%lastname%&lt;/td&gt;&lt;/tr&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;
  &lt;br&gt;
  
  &lt;h2&gt;Other Information&lt;/h2&gt;
  
  &lt;table&gt;
    &lt;tbody&gt;
      &lt;tr&gt;&lt;th&gt;Phone:&lt;/th&gt;&lt;td&gt;%phone%&lt;/td&gt;&lt;/tr&gt;
      &lt;tr&gt;&lt;th&gt;E-Mail:&lt;/th&gt;&lt;td&gt;%email%&lt;/td&gt;&lt;/tr&gt;
      &lt;tr&gt;&lt;th&gt;Organisation:&lt;/th&gt;&lt;td&gt;%organisation%&lt;/td&gt;&lt;/tr&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>My problem is that not all of these fields are required and i want to delete
  the whole table + the heading if none of these variables (phone, email,
  organisation) is set.</p>