Check if field only contains alphanumerics (no spaces or special chars)

A

account8226

Guest
#1
Hello,

I am trying to validate one of my fields. In my datawritter I am calling a validating function, that call a method 'validate' in my model.

PHP:
if (preg_match('/[^a-zA-Z0-9_]/', $username)) return false;
Why is that not working ? It's always returning false...
 
A

account8226

Guest
#2
Solved it, was just passing out the wrong variable ;) This preg match function works.
 
Top