How to insert nl2br function using htmlspecialchars ? I have a website where input is from textarea, and nl2br used to convert the next line to a paragraph. When I tried with htmlspecialchars , I got the result below. Here I wrote three words "test" in textarea and saved to the database. I use htmlspecialchars to prevent html injections, but due to this function the nl2br function nl2br not work. Can you tell me how to solve this problem?
test<br/>test<br/>test<br/>
source share