even after filtering some charaters, i still have yet to accompolish a bug free search engine. when those charaters are placed in between words like "Engine#$%$#% Cowling" ... the characters get filtered but not when its like this : " Engine Cowling %$#%" can some kind soul help me out ?

// Get the search variable from URL For Keyword Search
$Keyword = (isset($_GET['Keyword'])) ? $_GET['Keyword'] : '';
$trimmedKeyword = trim($Keyword);
//filter special characters such as % ^ &
$filter = array("`","'", "~", "\"" , "\\" , "!", "@" , "#" , "$" , "%" , "^" , "&" , "*" , "(", ")" , "+" , "{" , "}" , "[" , "]" ,  "<" , ">" , ";" , ":" , "?" , "/" ,"//" , "|" , "=");
$trimmedKeyword = str_replace($filter, '', $trimmedKeyword);
//trim whitespace from the stored variable : '/\s+/s --> to remove any additional spaces.
$trimmedKeyword = preg_replace('/\s+/s',' ',$trimmedKeyword);
$trimmed_arrayKeyword = explode(" ",$trimmedKeyword);

    ok thank you.. its working now.
    i have another question..
    ($trimmed_arrayKeyword as $trimmKeyword => $searchword)
    wads the => referring to in the above code?

      PHP-ing wrote:

      ok thank you.. its working now.
      i have another question..
      ($trimmed_arrayKeyword as $trimmKeyword => $searchword)
      wads the => referring to in the above code?

      Don't get hung up on it. It's just syntax to separate the array key and it's value. See manual page on foreach:

      http://us3.php.net/manual/en/control-structures.foreach.php

      .

        to add on to the above :
        Wads the ='b' for ? :if(strtoupper($searchword ) == 'b')

        foreach ($trimmed_arrayKeyword as $trimmKeyword => $searchword)
        {
        
        if(strtoupper($searchword ) == 'b')
        {
        $trimmed_arrayKeyword[$trimmKeyword] = "/\b(?<!<)$searchword(?!<)\b/i";
        continue;
        }
        
        else $trimmed_arrayKeyword[$trimmKeyword] = '/\b('.preg_quote($searchword,'/').')\b/i';
        
          Write a Reply...