RE: [PHP] Forms and viewing Text Area
| From: | Stuart Felenstein | Date: | Fri, 10 Dec 2004 11:29:34 +0000 |
| Subject: | RE: [PHP] Forms and viewing Text Area | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-203914@lists.php.net to get a copy of this message | ||
--- "Ford, Mike" <M.Ford@leedsmet.ac.uk> wrote:
> echo nl2br(htmlspecialchars($text)) is my usual
> mantra for this.
>
nl2br will give you back the correct formatting, but
will leave <br/>'s in the output.
I just went through this issue the other day, what I
found worked for me was:
htmlspecialchars('string'),ENT_NOQUOTES);
Note- check the available parameters for
htmlspecialchars. I used ENT_NOQUOTES because I wanted
to preserve the single and double quotes in my text.
Hope this helps.
Stuart