On Saturday 28 September 2002 03:30 pm, John W. Holmes wrote: > > Perhaps I don't understand the use of 'htmlentities' too well, but I > > would > > > like newlines to be retained/inserted into a db, and then if > > displayed, to > > > produce a new line from a textarea. However, I want the possibility of > > dangerous html excluded (hence the use of 'htmlentities'). > > > > Is there some way of excluding '\n \r ' and other newline indicators > > from > > > 'htmlentities()'? Perhaps a combination of preg_match and something > > else? > > > I'm > > a bit brained-fried struggling with other errant parts of this code > > since > > > 6 > > am. > > Any ideas how I could proceed? > > What's wrong with > > echo nl2br(htmlentities($text)); > > ?? > > ---John Holmes...
Thanks John, Well, as expected, the Preview function admirably displays text, with line breaks, from the textarea. However, once saved in the db (which used to display <br>'s) the db record now displays the same as on screen -- line breaks with no characters indicating linebreaks). Yet, if I call that particular record from the db, and display it on-screen, it's all on one line. So, I'm confused. Any ideas what to do to save it properly in the db so that on display, it renders the same way as in the Preview (pre-db insertion) mode? And now, ucfirst("$text"); refuses to work! Sigh . . . what a day! Tia, Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php