RE: [PHP] make hitting enter in a text box = <br>
| From: | John Holmes | Date: | Tue, 14 May 2002 02:02:27 +0000 |
| Subject: | RE: [PHP] make hitting enter in a text box = <br> | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-97457@lists.php.net to get a copy of this message | ||
Or you could use nl2br(), which is what the function was designed for.
Use it only when you echo the data to the browser, not when you store it
to a database. Also note that there is a slight difference. nl2br() will
leave the "\n" in there and _add_ a <BR>. The str_replace() example
will, umm, replace the "\n" with a "<br>".
---John Holmes...
> -----Original Message-----
> From: Martin Towell [mailto:martin.towell@world.net]
> Sent: Monday, May 13, 2002 9:47 PM
> To: 'Rob Packer'; php-general@lists.php.net
> Subject: RE: [PHP] make hitting enter in a text box = <br>
>
> when the data gets to php, do a $str = str_replace("\n", "<br>",
$str);
> (not tested, but should work)
>
> HTH
> Martin
>
>
> -----Original Message-----
> From: Rob Packer [mailto:rapacker@yellowbananas.com]
> Sent: Tuesday, May 14, 2002 2:33 PM
> To: php-general@lists.php.net
> Subject: [PHP] make hitting enter in a text box = <br>
>
>
> I have a simple script for a newsletter, with a text area box for
someone
> to
> type in their newsletter. Is it possible to make it so when someone
hits
> enter with the text box it will equal <br>?
>
> TIA
>
> Robert
>
> --
> -- NRC ONLINE --
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php