php/whitespace/formatting

andehlu

this modern love
hey all,

I cant believe ive havent run across this problem yet but i think its unsolvable....

Im making an app for content control of a site in php, have any of you come across a way to handle whitespace? For ex, what I would like to do is when a person is entering data into a text feild and they hit enter to make a line break, to maintain that linebreak to the dtabase? I just dont want to have make the users enter <br> etc......
 
You can use the php function nl2br( $string ) to replace all of the '\n' characters with <br /> tags.
 
I have to admit that I LOVE PHP... Every time I think there is an "unsolveable" problem, I later find out that I'm wrong... that there is some obsucre little command that solves the problem.

And even more common with PHP is the liklihood that there are 3 obsucre commands that solve the problem in slightly different ways.

This really is the miracle of Open Source!

:D
 
Gnomo said:
You can use the php function nl2br( $string ) to replace all of the '\n' characters with <br /> tags.

Sorry its been so long in responding to this.... Gnomo you genius!!! nl2br is EXACTLY what i was looking for! I love it!!!! Thanks.
 
Back
Top