I want to check if the content from a text area contains certain "bad words".
I read the content from the textarea with $_POST['message']
This is my textarea:
<textarea class="form-control" name="message" placeholder="MESSAGE"></textarea>
All the bad words are in an array:
// read bad words into array
$blacklistfile = 'blacklist/badwords.txt';
$blacklistarray = file($blacklistfile, FILE_IGNORE_NEW_LINES);
To check if the content of $_POST['message'] contains any of these bad words, i thought: put all the content of $_POST['message'] into an array and compare these arrays.
I tried in the textarea [] after the message:
<textarea class="form-control" name="message[]" placeholder="MESSAGE"></textarea>
and:
$usermessage = $_POST['message'];
print_r($usermessage);
But print_r() gives me no output
So how can i put the content of the textarea into an array??
Or: maybe there are other possibilities to achieve this?
ass, then I will trya.s.s.ora-s-sinstead.)a-s-sacceptable? if everything besides the full word(so without spaces next to eachother) is acceptable You can just post the message as string and use the php functionexplodeand explode on a space. Or even another way. There's a lot of ways of achieving this.