Jump to content

Why is this not working?


jdock1

Recommended Posts

Im trying to set up a swear word filter, one where when the user enters the swear word into the text box is echos an error

 

This is what I have:

 

if ($query == "shit || fuck || titties || penis || vagina")
{
echo "No swearing";
}

 

I also tried setting up this array:

$swearwords = array("swearword", "badword", "anotherswearword", "anotherbadword");

 

And used this if statement:

 

if ($query == "$swearwords")
{
echo "No swearing";
}

 

Im somewhat a beginner in PHP and thought this would work but Im probably just an idiot. What am I doing wrong?

Link to comment
https://forums.phpfreaks.com/topic/162650-why-is-this-not-working/
Share on other sites

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.