Re: multiline text areas and mysql doesn't work :(
| From: | Keith Ng | Date: | Sun, 13 May 2001 16:25:58 +0000 |
| Subject: | Re: multiline text areas and mysql doesn't work :( | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-52622@lists.php.net to get a copy of this message | ||
In reply to ciaron@eidosnet.co.uk:
> Return-Path: <php-general-return-52620-keith=k-designs.com.sg@lists.php.net>
> Received: from toye.php.net (va.php.net [198.186.203.51])
> by cobalt1.intermedia.com.sg (8.10.2/8.10.2) with SMTP id f4DGDXZ25935
> for <keith@k-designs.com.sg>; Mon, 14 May 2001 00:13:39 +0800
> Received: (qmail 12864 invoked by uid 1013); 13 May 2001 16:15:49 -0000
> Mailing-List: contact php-general-help@lists.php.net; run by ezmlm
> Precedence: bulk
> list-help: <mailto:php-general-help@lists.php.net>
> list-unsubscribe:
> <mailto:php-general-unsubscribe@lists.php.net>
> list-post: <mailto:php-general@lists.php.net>
> Delivered-To: mailing list php-general@lists.php.net
> Received: (qmail 12848 invoked by uid 9); 13 May 2001 16:15:49 -0000
> To: php-general@lists.php.net
> From: "Ciaron Nixon" <ciaron@eidosnet.co.uk>
> Date: Sun, 13 May 2001 17:22:28 +0100
> Lines: 9
> Message-ID: <9dmbvl$chc$1@toye.p.sourceforge.net>
> X-Priority: 3
> X-MSMail-Priority: Normal
> X-Newsreader: Microsoft Outlook Express 5.50.4133.2400
> X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
> Subject: [PHP] multiline text areas and mysql doesn't work :(
> X-UIDL: ;GH!!Oa4!!_P6"!Z&K!!
> I'm trying to insert the conents of a submitted textarea into a field of a
> db but it seems to be stripping the control characters or not fomatting them
> properly. The record updates fine but when I display it all the newlines are
> gone ie the whole field appears on 1 line.
> Any ideas how to get it to store the control chars?
> -Ciaron
Use nl2br() to format the display properly in HTML.
Goto www.php.net/nl2br for more info.
So this would work well:
<?php echo nl2br($query); ?>
Updating the record works because you probably did something like this:
<textarea><?php echo $query; ?></textarea>
Regards,
Keith Ng
_______________________________
Co-founder
K-Designs Incorporated
keith@k-designs.com.sg
http://www.k-designs.com.sg/