title: Writing a new and appending a file in PHP without erasing contents
body: <p>How could one write a new line to a file in php without erasing all the other contents of the file?</p>
  
  <pre><code>&lt;?php
  if(isset($_POST['songName'])){
  
          $newLine = "\n";
          $songName = $_POST['songName'];
          $filename = fopen('song_name.txt', "wb");
          fwrite($filename, $songName.$newLine);
          fclose($filename);
      };
  
  ?&gt;
  </code></pre>
  
  <p>This is what the file looks like
  <a href="http://i.stack.imgur.com/XAf7K.png" rel="nofollow">Current view</a></p>
  
  <p>This is what is should look like <a href="http://i.stack.imgur.com/wIENb.png" rel="nofollow">Ideal View</a></p>