Skip to content
Advertisement

Validate Mobile number in php form

I want to validate mobile number of 10 digits and also add a prefix of 0 when I enter into the database.

JavaScript

Now I get stuck in mobile number validation. I tried using regular expressions.

What I want to do is add a 10 digit phone number and make sure it is only digits or else give error and while entering the number to database I want to add a prefix to the mobile number of 0 so it should be like 0and10digitnumber

Advertisement

Answer

Try something like this :

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement