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);