I've been trying to work this out for about 45 minutes and I'm ashamed to say I haven't managed to find the answer.
Basically, I want to check that a textfield that has been submitted via a form is a numeric variable. If the stuff is numeric then cool, the person can stay on the page. But, if the variable is NOT numeric then I want to redirect the person to another page with an error message.
I've been reading up lots of fantastic ways of checking that a variable is numeric (such as the "is_numeric()" function). But I'm not so sure how to check that something is NOT numeric.
I've been trying things like,
if ((is_numeric($year=="false")) {
header ("location: bla bla bla.htm");
}
and...
if ((is_numeric($year==0)) {
header ("location: bla bla bla.htm");
}
and also...
if ((is_numeric($year!==1)) {
header ("location: bla bla bla.htm");
}
...but have had no luck so far.
So, does anyone know how to check that a variable is NOT numeric?