can anyone please help me know how to validate if the field value entered is a phone number using php...
I have used a variable $phone , datatype =varchar 10 in sql db
Now i want to validate that users enter only numbers in that field..
Answer
use preg_match
if(preg_match('/^(NA|[0-9+-]+)$/',$str)) {
*code here*
} else {
"code here"
}
No comments:
Post a Comment