How to save simple HTML formatting for text box input?

I only want to save the structure of the paragraph for entering users into the text box. When I extract text from db, the whole structure is lost. The easiest way to save text as recorded?

+4
source share
3 answers

use <pre></pre>

+5
source

replace spaces "with &nbsp; You cannot repeat multiple spaces" "in HTML, because they will be collapsed into one space.

Also, replace \ n with

Hope this helps!

0
source

If you want to save HTML text (rich text with BOLD, italics, etc.), you should use an editor such as CKEditor ( http://www.ckeditor.com )

-1
source

Source: https://habr.com/ru/post/1302330/


All Articles