title: PHP write file from input to txt - issue
body: <p>I've been at this for a while and been through other options on stack but can't get this to work. (I'm pretty nooby, sorry!)</p>
  
  <p>I have a form which i want to send data to my txt file but it's just not writing. </p>
  
  <p>ANY help greatly appreciated, thank you!!</p>
  
  <p>My HTML Form:</p>
  
  <pre><code>&lt;!doctype html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta charset="UTF-8"&gt;
  &lt;title&gt;php test&lt;/title&gt;
  &lt;/head&gt;
  
      &lt;title&gt;&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
          &lt;form action="myprocessingscript.php" method="POST"&gt;
      &lt;input name="field1" type="text" /&gt;
      &lt;input name="field2" type="text" /&gt;
      &lt;input type="submit" name="submit" value="Save Data"&gt;
  &lt;/form&gt;
      &lt;a href='/tmp/mydata.txt'&gt;Text file&lt;/a&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>And my PHP</p>
  
  <pre><code>&lt;?php
  if(isset($_POST['field1']) &amp;&amp; isset($_POST['field2'])) {
      $data = $_POST['field1'] . '-' . $_POST['field2'] . "\n";
      $ret =  fwrite('/tmp/mydata.txt', $data, FILE_APPEND | LOCK_EX);
      if($ret === false) {
          die('There was an error writing this file');
      }
      else {
          echo "$ret bytes written to file";
      }
  }
  else {
     die('no post data to process');
  }
  </code></pre>