title: how to write html table in .txt file using php
body: <p>I want to export datatable records in .txt file and am using doing this with file handling function but when I am  trying to create table in txt file it will give me the following output:</p>
  
  <p><img src="https://i.stack.imgur.com/HCwfP.png" alt="enter image description here"></p>
  
  <p>by doing this</p>
  
  <pre><code>    $fileName = 'filenametxt'.date('Y_m_d_H_i_s').".txt";
      $filePath = $upload_path.'/file_folder_txt/';
      $fileNameWithPath = $filePath.$fileName;
  
      $txtHeaderData .= '&lt;table id="" class="uk-table uk-table-hover uk-    table-striped uk-table-condensed" border="0" cellpadding="5"&gt;
          &lt;tr&gt;
              &lt;th&gt;Location&lt;/th&gt;
              &lt;th&gt;Filed Name&lt;/th&gt;
              &lt;th&gt;Length&lt;/th&gt;
              &lt;th&gt;Description of Fields&lt;/th&gt;
          &lt;/tr&gt;
  
      ';
      $txtHeaderData .= '&lt;/table&gt;';
      $handle = fopen($fileNameWithPath, "w");
      fwrite($handle, $txtHeaderData);
  </code></pre>
  
  <p>but the expected output is: </p>
  
  <p><img src="https://i.stack.imgur.com/XePRs.png" alt="enter image description here"></p>
  
  <p>can some please help me that how I can achieve this?</p>