Re: need to remove newline characters from form input
| From: | Five | Date: | Thu, 26 Feb 2004 20:21:52 +0000 |
| Subject: | Re: need to remove newline characters from form input | ||
| References: | 1 | Groups: | php.lang |
| Request: | Send a blank email to php-lang+get-560@lists.php.net to get a copy of this message | ||
I think, after 4 hours of searching functions and exxperimentation I've found a simple yet
elegant solution.
$message = ereg_replace( "\n", " ", $message);
It seems to replace all new line instances with a blank space.
Wooohooo!
"Five" <primeooze@hotmail.com> wrote in message news:20040226195911.84897.qmail@pb1.pair.com...
> I'm writing a simple threaded message board using only php.
>
> I have it worked out except for having to make sure the user input from a <TEXTAREA>
> doesn't have new line characters. I need to
add
> those myself. Is there an easy way, short of checking each character in a loop, to rid input of
> new line characters.
>
> Also, ( this might come in handy lol ) what new line character is created when the user presses
> the Enter key when filling a form
> field? If they aren't " \n" I'm not sure what Im looking for.
>
> much advance thanks,
> Dale