The code below shows a simple way to check if the name field only contains letters and whitespace. If the value of the name field is not valid, then store an error message.
Code
$name = test_input($_POST["name"]);
if (!preg_match("/^[a-zA-Z ]*$/",$name)) {
$message = "Pleas enter Specific Name!!";
}