jayant kumar jayant kumar - 1 year ago 87
PHP Question

php code to validate alphanumeric string

I want to validate alphanumeric string in form text box in php. It can contain numbers and special characters like '.' and '-' but the string should not contain only numbers and special characters. Please help with the code.

Answer Source

Try this

if(preg_match('/^[a-zA-Z]+[a-zA-Z0-9._]+$/', input))
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download