PHP Classes

block out certain words from search

Recommend this page to a friend!

      Top level forums  >  PHP Specialists  >  General  >  block out certain words from search  
Subject:block out certain words from search
Summary:block out certain words and more than one word
Messages:2
Author:Butch Walker
Date:2012-06-12 15:02:58
Update:2012-06-12 23:48:12
 

  1. block out certain words from search   Reply   Report abuse  
Picture of Butch Walker Butch Walker - 2012-06-12 19:16:46
I am lost again need the experts...
(I can't believe I can't find something like this a novice can rewrite into his code)

I have a simple form that searches a concordance:

<form method="post" action="result.php" name="keysearch" >

<h3>Enter single word at least 3 characters long.</h3>

<input type="text" name="search" value="" size="40" /><br />
<input type="submit" value="Display Results" />
</form>

==================================
First part, I need to stop people from searching on anything less than 3 characters long and no spaces (i.e. 2+ words) in the search box.

Second part, I need to make sure that the following list is not allowed, something like:

$forbidden_word="she"||"they"||"them";

# if $forbidden_word matches the submitted word
if($_POST['keysearch']==$forbidden_word)
{
$message='The word: '.$forbiden_word.' is not allowed;
}
else

SEND FORM





There is 1 reply in this thread, which is not being displayed.
Browsing this forum thread replies is available only to premium subscribers.


Go to the premium subscriptions page to learn how to become a premium subscriber and have full access to this forum.