redarrow Posted February 11, 2007 Share Posted February 11, 2007 if i want to get all the words comming from a form to use the below code what do i do, would i need to implode or explode the blog varable from the form to cheek the words. <?php $check_words=array("<",">","?","@","*","(",")","=","-","_"); foreach($check_words as $word){ if($blog==$word){ echo " soory word wrong"; exit; } } ?> Quote Link to comment Share on other sites More sharing options...
redarrow Posted February 11, 2007 Author Share Posted February 11, 2007 ok lets make this easer if i make a message like this <?php $words="i love php"; ?> how can i get all the words in $words to be in an array. Quote Link to comment Share on other sites More sharing options...
redarrow Posted February 11, 2007 Author Share Posted February 11, 2007 solved it cheers. <?php $word="my name is ? john"; $test=explode(" ",$word); foreach($test as $blog){ $check_words=array("<",">","?","@","*","(",")","=","-","_"); foreach($check_words as $word){ if($blog==$word){ echo " sorry this is not allowed $word please try agin!"; exit; } } } ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.