Advertisement
kilya

PHP - Export Content to MS Word document

May 27th, 2020
1,064
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.66 KB | None | 0 0
  1. <form name="proposal_form" action="<?php echo htmlspecialchars(stripslashes(trim($_SERVER['PHP_SELF']))); ?>" method="post">
  2.   <input type="submit" name="submit_docs" value="Export as MS Word" class="input-button" />
  3. </form>
  4. <?php
  5.   if(isset($_POST['submit_docs'])){
  6.           header("Content-Type: application/vnd.msword");
  7.           header("Expires: 0");//no-cache
  8.           header("Cache-Control: must-revalidate, post-check=0, pre-check=0");//no-cache
  9.           header("content-disposition: attachment;filename=sampleword.doc");
  10.   }
  11.   echo "<html>";
  12.   echo " <h1>PHP - Export Content to MS Word document</h1>
  13.        <p>This is a test.<p>";
  14.   echo "</html>";
  15. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement