title: how to user nl2br function with htmlspecialchars in phpmysql
body: <p>How to insert <code>nl2br</code> function with <code>htmlspecialchars</code>? I have a site where input is taken from textarea and <code>nl2br</code> is used to convert next line to a paragraph. When I tried with <code>htmlspecialchars</code> I got the below output. Here I wrote three 'test' words in textarea and saved in database. I am using <code>htmlspecialchars</code> to prevent html injections but because of this function <code>nl2br</code> function is not working. Can you tell be how to work around this problem?</p>
  
  <pre><code>test&lt;br/&gt;test&lt;br/&gt;test&lt;br/&gt;
  </code></pre>