[PHP-DB] [mysql - php] Newline to BR problem

2003-01-09 Thread Ro Stonemountain
I'm trying to place a text from a textfield into a database and displaying
it on another page. All works fine and well but my problem is:

If i place newline characters (press enter) in the forms textfield they
don't show up on my display page. This is logical because newlines are not
br codes. So i must replace the newline thingies with br code. Should
this be done BEFORE i put the text in the database or AFTER i put the text
in the database and what functions can i use

Maybe it's a newbie question but it's on my mind for a few days now and i
haven't found an answer yet, thanx!



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DB] [mysql - php] Newline to BR problem

2003-01-09 Thread Aaron Wolski
You want to look at nl2br() function.

It takes newlines from a text like:

Hello

My name is

Aaron

Which when outputted normally would look like:

Hello my name is aaron

Using echo nl2br($dbquery); would produce:

Hellobrbr
My name isbrbr
Aaronbrbr

In your HTML code which then would output in a browse like the above.

Aaron

-Original Message-
From: Ro Stonemountain [mailto:[EMAIL PROTECTED]] 
Sent: January 9, 2003 10:53 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] [mysql - php] Newline to BR problem

I'm trying to place a text from a textfield into a database and
displaying
it on another page. All works fine and well but my problem is:

If i place newline characters (press enter) in the forms textfield they
don't show up on my display page. This is logical because newlines are
not
br codes. So i must replace the newline thingies with br code.
Should
this be done BEFORE i put the text in the database or AFTER i put the
text
in the database and what functions can i use

Maybe it's a newbie question but it's on my mind for a few days now and
i
haven't found an answer yet, thanx!



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php