My account creation script's name input is validated with a preg_match
as the field is only allowed to have either Latin or Cyrillic characters (in other words, it cannot have both), however, no matter what the name field contains, the preg_match
condition is never satisfied. So far I've tried three possible variations of the code:
if (!(preg_match('/^[a-z]$/i',$_POST['name']) || preg_match('/^[а-я]$/i',$_POST['name']))) back('The message');
if (!preg_match('/^[a-z]$/i',$_POST['name']) && !preg_match('/^[а-я]$/i',$_POST['name'])) back('The message');
and one that attempts to stuff both the preg matches into one.
Could anyone please help me out in fixing this issue?