javascript - How to export dynamic html table to doc file using php? -


i'm new using php , need bit of here.

i'd send html table php file, , then, able use information (specifically want download doc file).

i've seen lot of information how it. haven't seen how without <tbody></tbody>. have dynamic table, so, data loading array. way, i'm using datatable-jquery it.

i have following html code:

<form action="sectorestable.php" method="post">      <table id="sectorestable">         <thead>             <tr>                 <th><b>#</b></th>                 <th><b>numero</b></th>                 <th><b>nombre</b></th>             </tr>         </thead>         <tbody>         </tbody>     </table>     <button type="submit" style="margin-top: 20px;">exportar</button> </form> 

and sectorestable.php:

<?php      header("content-type: application/vnd.ms-word");     header("content-disposition: attachment; filename=tablasectores.doc");       echo ''; ?> 

by way, load data table, i'm using following script:

<script>     $('#sectorestable').datatable({         data: arraysectores     }); </script> 

in general working good, download doc file without information (and right because echo printing nothing.).

i understand need use foreach in html code? really, i'm not sure.

any idea?

try use api,to export dynamic html table doc file in php

http://www.phpclasses.org/package/2763-php-convert-html-into-microsoft-word-documents.html 

Comments