Re: Preserving line breaks from form data.

From: Date: Sat, 29 Jul 2000 14:20:32 +0000
Subject: Re: Preserving line breaks from form data.
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-8957@lists.php.net to get a copy of this message
On Sat, Jul 29, 2000 at 08:58:25PM +0800, Shashank Tripathi wrote: > You could escape the newline characters with an HTML BREAK ("<BR>"). For > instance, lets say the name of your HTML form's textbox is "mytext", then > the PHP code to read the text that a user entered in "mytext" would be: > > ------------------------------------------------- > <?php > echo ereg_replace( "\n", "<br>", $mytext ); > ?> > ------------------------------------------------- Or even beter: echo nl2br($mytext); See http://www.php.net/manual/function.nl2br.php. -- Jon Parise (jon@csh.rit.edu) . Rochester Inst. of Technology http://www.csh.rit.edu/~jon/ : Computer Science House Member

« previous php.general (#8957) next »