Jump to content

[SOLVED] checking words with inplode or explode?


redarrow

Recommended Posts

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;
}
}
?>

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;
}
}
  }
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.