Page 1 of 1

Removing a word from a TEXTAREA?

Posted: Fri Jan 10, 2003 3:15 pm
by rxsid
Hi all,

I have a form with a <textarea> on it. I don't want to allow things such as email addresses or website url's.
After the form is submitted, how can I use PHP to remove those items? In other words, can I delete a single word in a textarea?

Posted: Fri Jan 10, 2003 4:40 pm
by volka
after the form is submitted it doesn't matter to php where the paramter came from (input text, - hidden, textarea, ...). So your question turns out to be "How can I delete certain words from a string in php".
For what you've described I suggest mixed preg_replace ( mixed pattern, mixed replacement, mixed subject [, int limit]) to replace all ocurrences of what seems to be an email-address or url.
There have been several threads on the topic what pattern to use to detect urls or emails-addresses, e.g. viewtopic.php?t=2369
But feel free to search another. I tried "pattern AND url" and "pattern AND email".