Re: Wrapping problems

From: Date: Wed, 07 Jun 2000 07:58:10 +0000
Subject: Re: Wrapping problems
References: 1 2  Groups: php.db 
Request: Send a blank email to php-db+get-243@lists.php.net to get a copy of this message
I have also been faced with this problem, and have not found any surefire solution yet. The problem typically is when you have a texfield in a form, e.g. a FAQ, where the user enters a code snippet. This kind of entry would be almost unreadable without adding the <pre></pre> to the entry. But, if the user enters a long line of text (wrap=virtual) the retrieved text won't wrap. Maybe the nl2br() is the way to go, even if the monospaced 'formatting' is lost (code indentation in code snippets would be lost I guess)? Ray Black III wrote: > > By the text's "formatting" I guess you mean line breaks? I can't imagine > what else there is to format in straight text... > > Anyway, easy solution to this: > echo nl2br($str); > > http://www.php.net/manual/function.nl2br.php > > -r3- > > ----- Original Message ----- > From: Paul O' Connor <paul-oconnor@ardee.aibp.ie> > To: <php-db@lists.php.net> > Sent: Tuesday, June 06, 2000 11:33 AM > Subject: [PHP-DB] Wrapping problems > > > Hi, > > > > I'm using PHP and MySQL to develop a knowledge base at work. > > I'm kind of new to PHP. > > > > I have a problem in that users are asked to enter in a full description to > > the knowledge base via a textarea on a form. > > > > This info is then stored in a field of type text. > > > > My problem is in displaying this text field. The text that will be entered > > will be formatted, e.g. > > > > 1. Step 1 > > 2. Step 2 > > 3. Step 3 > > > > However, when I display the description (in a table) - the text looses > it's > > formatting giving > > 1. Step 1 2. Step 2 3. Step3. > > > > I've tried to use the <PRE> tag in the table generated by my PHP code but > > that results in the table growing as wide as the longest line of text > > instead of wrapping within the confines of the table. > > > > I've tried specifing a % width on my generated table but this doesn't work > > either. > > > > Any clues? > > > > Paul O' Connor. > > > > > > -- > > PHP Database Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net > > For additional commands, e-mail: php-db-help@lists.php.net > > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net > For additional commands, e-mail: php-db-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net -- ====== Rune Kallhovd, CORENA Norge AS ====== = Software Engineer = = P.O.Box 1024, N-3601 Kongsberg, NORWAY = = Tlf: +47 32 73 7448, Fax: +47 32 73 6877 = == CORENA Home Page: http://www.corena.no ==

« previous php.db (#243) next »