php - Using nl2br and mysql_real_escape_string at same time -


The correct way to use nl2br is as follows.

I have post data that has a text field input

  $ data = $ _POST; $ Escaped_data = array (); Forex currency ($ data as $ key = & gt; $ val) {$ escaped_data [$ key] = mysql_real_escape_string ($ val); } $ Desc = $ escaped_data [description]; $ Desc = nl2br ($ desc); In fact, the correct way to use nl2br () is to use it at all. When you store your data - this is when you read from the database and the client is going to output it. The data should be formatted when the database is installed, what if you want to create a restore service later and you really need those newlines instead of the HTML-element? 


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

jquery - SimpleModal Confirm fails to submit form -

php - Multiple Select with Explode: only returns the word "Array" -