I want to save html-formatted text to database, but when I do that it is don't save html-symbols like < / > ' and others
This is how I read article from database for editing:
Англійський варіант:
" >
after this generates such html-code:
Англійський варіант:
So, I expect that this text will appear in my text field, in html-code of this page it is, but in text area is no.
In database I save it as:
Hello
So how can I do the follow:
Read from database
html-formattedtext.
Show it in textarea element.
Edit and save it back to database.
Help me please, how can I save such texts properly, Thanx!
解决方案
Try using htmlspecialchars() on the string to put into the DB, and then, when pulling it back out, use htmlspecialchars_decode(). Might make a difference.