0

I have a form on a website for visitors to create an account. I need to make sure each field is in a certain format before saving it.

Username - only letters, numbers and underscore.

Password - Anything that's not harmful, how avoid php/html code?

Email - valid email (filter_var()?)

Mobile - 10 digit number (is_numeric()?)

Birthdate - needs to be YYYY-MM-DD, I'm using input type 'date'

Do I need to use Reg Ex to accomplish this?

jstudios
  • 856
  • 1
  • 9
  • 26

1 Answers1

1

You can also take a look at Php Filter / Validation or event Sanitization http://php.net/manual/en/book.filter.php

ffab
  • 11
  • 1
  • 3