eregi() deprecated since PHP 5.3, use preg_match() .
Note that preg_match() is case insensitive when you pass modifier i in your regular expression.
include 'db_connect.php'; if(isset($_POST['Submit'])) { $acc_type=ucwords($_POST['acc_type']); $minbalance=ucwords($_POST['minbalance']); // Removed AZ here, since the regular expression is case-insensitive if (!preg_match("/^[az ]+$/i", stripslashes(trim($acc_type))))//line 20 { echo "Enter Valid Data for Account Type!"; exit(0); } else { // \d and 0-9 do the same thing if (!preg_match("/^[\d ]+$/", stripslashes(trim($minbalance))))//line 27 { } } }
source share