line breaks

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
m2babaey
Forum Contributor
Posts: 364
Joined: Sun May 20, 2007 9:26 am

line breaks

Post 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
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

nl2br()

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