Page 1 of 1

string replace

Posted: Tue Aug 19, 2003 12:22 pm
by nincha
any one got an idea how i can use javascript onSubmit to replace all bad words in the textarea field?

Posted: Tue Aug 19, 2003 2:09 pm
by delorian
Why do you want to do this using Javascript. Someone can send the text with bad words omitting you anti-bad-word-system. It's better to do it with PHP e.g.:

Code: Select all

$good_txt = preg_replace("(bad_word1|bad_word2|bad_word3)i","[censored]",$_POST['textarea_bad_txt']);
Or you can have those bad words in the table and make a loop.