Problems with user's newlines
| From: | kris | Date: | Mon, 10 Jul 2000 20:30:42 +0000 |
| Subject: | Problems with user's newlines | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-5805@lists.php.net to get a copy of this message | ||
Hello,
I am using Php3, JavaScript, and mysql on my site. I have a textbox
that users can fill in; this is stored in a database. Later, this
information will be redisplayed in a web page. The way the webpage is
generated is by using php to generate javascript which generates html.
It works fine unless the user puts in a newline. Then javascript
complains that the lines are not terminated. But I have been trying to
do ereg_replace on the strings:
$string = ereg_replace("\n","<BR>",$string);
I'm getting the <BR>'s, but still the newlines seem to be there. I
tried matching on "\\\n" and got the same result. Does anyone have any
ideas why this match is not working?
Thanks,
Kris L.