Allow only Alphabets string in PHP

0
78
PHP

This tutorial explains how to restrict user to provide only Alphabets string in Input Text in PHP

function is_alphabet_text_input($data) {
if (!preg_match("/^[a-zA-Z ]*$/",$data)) 
   return true;
else
    return false;
}

Here we use regular expression to validate the input. you can use this function anywhere in your project.

LEAVE A REPLY

Please enter your comment!
Please enter your name here