A user post a comment on a forum using a textarea, he presses enter to format his text which means line breaks, how can I convert those line breaks to html breaks when inserting its message on the database so the message is echoed with the line breaks formatting?
Share
There’s a function called
nl2br(). Use it when echoing data, not when inserting to database. You don’t want to display those<br/>tags when the user opens their post in textarea for editing, do you?