The simplest can be
preg_match('/^[a-z]+$/i', $_POST['chaine'])
the i
modifier is for case-insensitive. The +
is so that at least one alphabet is entered. You can change it to *
if you want to allow empty string. The anchor ^
and $
enforce that the whole string is nothing but the alphabets. (they represent the beginning of the string and the end of the string, respectively).
If you want to allow whitespace, you can use:
Whitespace only at the beginning or end of string:
preg_match('/^\s*[a-z]+\s*$/i', $_POST['chaine'])
Any where:
preg_match('/^[a-z][\sa-z]*$/i', $_POST['chaine']) // at least one alphabet
Only the space character is allowed but not other whitespace:
preg_match('/^[a-z][ a-z]*$/i', $_POST['chaine'])