First, You must get the searched string from the textfield, with
<? $var = $HYYP_POST_VARS["textfieldname"];
?>
Then, split $var into an array (for example):
<? $arSplit = explode(" ", $var); ?>
Now, verify if every $arSplit[$i] is 'AND', 'OR', 'NOT':
<? $blnAND = strcasecmp($srSplit, 'AND'); ?>
and create the appropriate query, for example:
<?
$sSQL = SELECTarticle, keyword FROM MyNewspaper
WHERE keyword = 'Animal'
AND keyword = 'Vegetal';
?>
Read the string functions in the PHP Manual, and something about SQL, and test in MySQL every query You make.