nl2br() will do the translation for you, just store the text in database in
the form user writes it (allows later editing of the messages in the db
without having to deal with <br>'s) and then echo(nl2br($message)) it.

Pavel


----- Original Message -----
From: "Ignacio Vazquez-Abrams" <[EMAIL PROTECTED]>
To: "david klein" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, January 16, 2001 5:25 PM
Subject: Re: [PHP] How to handle multiple lines in PHP?


> On Tue, 16 Jan 2001, david klein wrote:
>
> > I have a textarea in one php page to allow user to leave message. How
ever,
> > if the user input(three lines):
> >
> > 123
> > 456
> > 567
> >
> > after I get it through some php scripts, and put it into database, later
on,
> > I try to display it, but it becomes(only one line):
> >
> > 123 456 789
> >
> > Does anyone know how to handle this? One idea is to convert the <END OF
LINE
> > CHAR> to "<BR>" before putting it into the database, but how can we
detect
> > the <END OF LINE CHAR> in PHP?   Or is there any other ways?
> >
> > Thank you very much in advance.
> >
>
> The newline char in PHP is '\n'.
>
> --
> Ignacio Vazquez-Abrams  <[EMAIL PROTECTED]>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to