Simple Form Validation in PHP


Perform simple form validation to check if fields are empty.

Source Code

if (empty($_POST['username']) || empty($_POST['password'])) {
    echo "Both username and password are required.";
} else {
    echo "Form input validated.";
}
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments