PHP string validation?

AliOki

New member
So a contact script I made is being spammed. I want to add a input field where the user must type in a phrase I set. Let's say the word is "kittens" and the input field will be named "checker".

How would I go about validating that what the user inputed is the word "kitten"? I'm really new with PHP (i've done layouts but never any programming type stuff) and I know how to validate with a string is alphanumeric, but I've never done a string before.

Is it something like:

if (preg_match("kitten", $_POST['checker']))
elseif


Yeah, I've confused myself.. hah. Help please?
Thanks Dave, but I'm not quite sure if that's it.

If the word matches I want the form to go through, if it doesn't match I want an error to show when submit is clicked.

So i was thinking it'd be easy to have the if condition be negative, ie: if the string doesn't equal kitten then error message.
 
Back
Top