php – Field validation problems & # 39; Name & # 39; of the contact form

I'm new to PHP and have been putting together my own contact form …

I have problems so that the form is not validated in scenario 2 below. Code also below.

SCENARIO 1: 2 letters or numbers entered = error appears and the email is not sent.

SCENARIO 2: More than 3 numbers are entered = an error appears, but the email is NOT sent.

$ (document) .ready (function () {
$ ("# contact_email"). focus (function () {
if ($ ("# contact_name"). val (). length <3) {
$ ("# contact_name"). css ("border", "solid 1px # D295B5");
} else {
if (allLetter ($ ("# contact_name"). val ())) {
$ ("# contact_name"). css ("border", "solid 1px # D295B5");
} else {
$ ("# contact_name"). css ("border", "solid 1px # DADB93");
}
}
});


function allLetter (inputtxt) {
letters var = / ^[A-Z a-z]+ $ /;
if (inputtxt.match (letters)) {return false;}
else {return true;}
}

Any idea is what I'm missing? So if ANY number is entered in the name field, it will not be sent.