How to PHP Validate Name

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))…

Read MoreHow to PHP Validate Name

How to PHP Validate Email

Here’s the absolute easiest way you can validate an email address using PHP. This tiny function takes advantage of the filter_var() function in PHP. Code $email = test_input($_POST[“email”]); if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { $message = “Invalid email format”; }

Read MoreHow to PHP Validate Email