depojones Posted April 25, 2010 Share Posted April 25, 2010 Hi all, I have an input that must not allow alphanumeric; which I believe is the combination of alphabets and numbers. How do I validate the form in php to output error if the input contains numbers. Thanks in advance Link to comment https://forums.phpfreaks.com/topic/199709-alphanumeric-in-a-form/ Share on other sites More sharing options...
ChemicalBliss Posted April 25, 2010 Share Posted April 25, 2010 preg_match is very useful. if(preg_match("/[0-9]+/i",$string) == true){ // contains numbers } -cb- Link to comment https://forums.phpfreaks.com/topic/199709-alphanumeric-in-a-form/#findComment-1048191 Share on other sites More sharing options...
depojones Posted April 25, 2010 Author Share Posted April 25, 2010 Thanks. worked like a charm Link to comment https://forums.phpfreaks.com/topic/199709-alphanumeric-in-a-form/#findComment-1048196 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.