I am creating a CMS application. I am trying to save the text in the DB(MySQL). While trying to retrieve the value, I see that the line breaks are not reflecting in my HTML.
How can i retrieve the text with the respective formatting.
I have already tried using htmlentities()
, nl2br()
in php, but that doesn't work.
Eg:
Input text:
Hello World.
This is John
value that I see after being retrieved from DB:
Hello World. This is John.
You are storing data without any HTML tag, if you want to display the data as it was when you typed it in the text input, i think you use a WYSIWYG editor which wraps your text into HTML tags, there are many of them like ckeditor, summernote.