SHARE
TWEET

PHP - Export Content to MS Word document

kilya May 27th, 2020 (edited) 922 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top