title: PHP write post to file not working
body: <p>I am trying to get a simple form which will write to a file using php. But I am running into an error where whenever I try and write a value got through post, it writes '0' to the file instead of the value.</p>
  
  <p>I have a form like the following:</p>
  
  <pre><code>&lt;form method="post" action="test.php"&gt;
  &lt;input type="text" name="user" /&gt;
  &lt;input type="submit" value="submit"/&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>And test.php gets the user from the form via:</p>
  
  <pre><code>$user = $_POST['user'];
  </code></pre>
  
  <p>I can display <code>$user</code> on the page fine, and I have been able to write strings to the file using <code>fwrite</code> fine as well. But whenever I <code>fwrite($file,$user)</code> the only thing written is a <code>0</code>. What am I doing wrong?</p>