Keep all html whitespaces in php mysql
i want to know how to keep all whitespaces of a text area in php (for send
to database), and then echo then back later. I want to do it like
stackoverflow does, for codes, which is the best approach?
For now i using this:
$text = str_replace(' ', '&nbs p;', $text);
It keeps the ' ' whitespaces but i won't have tested it with
mysql_real_escape and other "inject prevent" methods together.
For better understanding, i want to echo later from db something like:
function jack(){
var x = "blablabla";
}
Thanks for your time.
No comments:
Post a Comment