RE: [PHP-WIN] How to detect CR

From: Date: Tue, 10 Oct 2000 14:37:27 +0000
Subject: RE: [PHP-WIN] How to detect CR
Groups: php.windows 
Request: Send a blank email to php-windows+get-3104@lists.php.net to get a copy of this message
And what about native php function nl2br (new line to <BR>)? Jan > -----Original Message----- > From: Andy Hoffman [mailto:andy.hoffman@bms.com] > Sent: Tuesday, October 10, 2000 4:02 PM > To: php-windows@lists.php.net > Subject: Re: [PHP-WIN] How to detect CR > > > "CESBRON S." wrote: > > > I've got a database field which is field with data, that come from a > > TEXTAREA input. It contains therefore some CR. What I to > do, is to be able > > to display it as it was entered. This means with the CR. > > The problem is that I couldn't detect the CR to put a <br> tag. > > > > Does anyone know how to do it ? > > I'd change all newlines into <br>s when updating the database > using regular > expressions or using str_replace function... in this case (to > avoid increasing > #s of <br>s on every update) I'd recommend using ereg_replace. > > Search for the following regular expression... > > /(<br>)*\n(<br>)*/ --- perl syntax > > and simply replace with... > > <br> > > Call to ereg_replace would look like... > > ereg_replace("(<br>)*\n(<br>)*", "<br>", $sourceString); > > -- > Andy Hoffman > Web Developer > Bristol-Myers Squibb > email: andy.hoffman@bms.com > > > > -- > PHP Windows Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net > For additional commands, e-mail: php-windows-help@lists.php.net > To contact the list administrators, e-mail: > php-list-admin@lists.php.net >

« previous php.windows (#3104) next »