I am developing website that allow user sending feedback to system. I have created feedback form by using textarea and button for submit. In most important thing is when user click on submit, if user input some words that I don't want them to input, that feedback won't send to the system; it will alert user to drop out that word before cicking submit.
Since now, i just create a simple code that will echo some warning if user input the word that i don't want them to input in feedback form.
Here is my code
<form action="main.php" method="post">
<textarea cols='10' rows='5' name='text'></textarea>
<br/>
<input type='submit' name='add' Value='Add to list' />
</form>
<?php
if (isset($_POST['add'])) {
$banned = array('dog', 'cat', 'cow'); // Add more
$entry = $_POST['add'];
foreach($banned as $word): if (strpos($entry, $word) !== false) die('Contains banned word');
endforeach;
}
?>
It is not work. Can anyone help me to solve this problem?
Thank in advance.