title: Line breaks / returns in a text area retrieved with php
body: <p><strong>EDIT:</strong>
  My problem simplified I suppose has boiled down to not being able to completely remove the new line character.</p>
  
  <p>I tried: <code>$new_content = str_replace("\n", '&lt;br/&gt;', $_POST["new_content"]);</code>
  And I can't see a reason why this wouldn't work.. but when I inspect the text file I still have a mysterious new line like so:</p>
  
  <pre><code>event:|:Test:|:Line 1
  &lt;br/&gt;Line 2:|:September 29th, 2012
  </code></pre>
  
  <p><strong>Original question:</strong></p>
  
  <p>I have a form with a text field and a VERY simple 'database', that's just a .txt file, that i am storing the submitted form data in. It all works well aside from one major issue i've just noticed. If a user presses the enter/return key to go to a new line in the text box, whatever the resultant string is it messes up my text file where a new line signifies another row in the database.</p>
  
  <p>For examples here's what the text file typically should look like:</p>
  
  <pre><code>type:|:heading:|:content:|:date
  event:|:Big Event 2012:|:More info and booking details.:|:September 29th, 2012
  event:|:Website relaunch:|:Keep your eyes pealed.:|:September 25th, 2012
  </code></pre>
  
  <p>Now if i were to fill out the form pressing the return key in the text box to start a new paragraph my text file looks like this:</p>
  
  <pre><code>type:|:heading:|:content:|:date
  event:|:Test:|:paragraph 1
  paragraph 2:|:September 29th, 2012
  event:|:Website relaunch:|:Keep your eyes pealed.:|:September 25th, 2012
  </code></pre>
  
  <p>As you can see the string has resulted in a new row being used in the database whereas i would expect / desire something like..</p>
  
  <pre><code>event:|:Test:|:paragraph 1 \n paragraph 2 :|:September 29th, 2012 //or
  event:|:Test:|:paragraph 1 &lt;br/&gt; paragraph 2 :|:September 29th, 2012
  </code></pre>
  
  <p>I did try looking for similar questions online but all the solutions pointed towards using something like <code>nl2br($_POST["new_content"]);</code> but that seems to produce a text file formatted like this:</p>
  
  <pre><code>type:|:heading:|:content:|:date
  event:|:Test:|:paragraph 1&lt;br /&gt;
  
  paragraph 2:|:September 29th, 2012
  event:|:Website relaunch:|:Keep your eyes pealed.:|:September 25th, 2012
  </code></pre>
  
  <p>Where the original problem still persists. Can someone explain why this happens or do you have any suggestions for how i should be formatting the string retrieved by <code>$_POST["new_content"]</code> before saving it in the text file? Would appreciate any help!</p>