Page 1 of 1

line breaks

Posted: Wed May 30, 2007 8:49 am
by m2babaey
Hi
Devnetwork was very helpful to me. I started reading php and mysql tutorials about 2 weeks ago ( or less) and now with your help for troubleshooting i am able to create my custom cms.
now only remains 1 problem.
when my website users post their articles, they press Enter to go to the next line or make another paragraph, you know.
And you know that their line breaks are not shown up after they submit the article then retrieve them. some suggested i install html purifier. but i'm not sure that'll be suitable. it is difficult for most of users to learn how to use that codes. they mainly like to type! only. like what i'm doing with phpbb now.
by the way, which function do you recommend for cleaning the data posted from the forms when they're going to be stored in a database. get_magic_quotes_gpc? mysql_real_scape_string? addslashes? or another function?
thanks

Posted: Wed May 30, 2007 9:01 am
by superdezign
nl2br()

Only use nl2br() when it's being taken FROM the database, not to it.