title: htmlentities() does it remove return character and carriage return?
body: <p>I am creating a forum with PHP and MySQL with the help of PDO class. I have just started coding the forum and come up with a problem.</p>
  
  <p>What I am doing is that</p>
  
  <pre><code>$post_body = htmlentities($_POST['post_body']);
  </code></pre>
  
  <p>get the user input like this and then send this to my function that then query this into the database like this</p>
  
  <pre><code>$str = $this-&gt;database-&gt;prepare('INSERT INTO `blah`,`blah_blah` VALUES(?,?)');
  $str-&gt;bindValue(1,$someVal);
  $str-&gt;bindvalue(2,$post_body);
  
  $str-&gt;execute();
  </code></pre>
  
  <p>and when I display these details i do something like this</p>
  
  <pre><code>html_entity_decode($postDetails['post_body']); //$postDetails has been initialized correctly
  </code></pre>
  
  <p>Yes I have added try catches and handled the exceptions; but since this is a forum post, when a user presses return key, he/she expects to have a new line in the posted article. but when i display these posts i am losing every return/new lines in the post. Why and how do I get around this.</p>
  
  <p>Explanation about wht this happens would be much appreciated!</p>
  
  <p>Thanks in advance.</p>