title: HTML form export to Word document
body: <p>Firstly i'm not web developer so be easy on me :)</p>
  
  <p>What i'm looking to do is have a user fill out a normal html form and store it in a word document. Here's the form:</p>
  
  <pre><code>    &lt;form action="test2.php" method="post"&gt;
  Name: &lt;input type="text" name="name"&gt;
  Email: &lt;input type="text" name="email"&gt;
  &lt;input type="submit"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>And here is test2.php:</p>
  
  <pre><code>&lt;?php
          header("Content-type: application/vnd.ms-word");
          header("Content-Disposition: attachment; Filename=SaveAsWordDoc.doc");
  ?&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head&gt;
  &lt;meta http-equiv=\"Content-Type\" content=\"text/html; charset=Windows-1252\"&gt;
  &lt;title&gt;Saves as a Word Doc&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;h1&gt;Header&lt;/h1&gt;
    This text can be seen in word
  &lt;ul&gt;
  &lt;li&gt;List 1&lt;/li&gt;
  &lt;li&gt;List 2&lt;/li&gt;
  &lt;/ul&gt;
  &lt;/body&gt;
  &lt;/htm&gt;
  &lt;html&gt;
   &lt;body&gt;
  
   Hello &lt;?php echo $_POST["name"]; ?&gt;!&lt;br&gt;
   Your mail is &lt;?php echo $_POST["mail"]; ?&gt;.
  
   &lt;/body&gt;
   &lt;/html&gt;
  </code></pre>
  
  <p>I'm not massively familiar with PHP so any help would really be appreciated.</p>
  
  <p>Thanks,</p>