anzichè if($_SESSION['text']==$val){ avresti if(strpos($val, $_SESSION['text'])) {
...c'è anche la versione "case insensitive" se preferisci...
anzichè if($_SESSION['text']==$val){ avresti if(strpos($val, $_SESSION['text'])) {
...c'è anche la versione "case insensitive" se preferisci...