What are the potential pitfalls of using HTML for input validation in PHP and how can they be mitigated?

Potential pitfalls of using HTML for input validation in PHP include the risk of client-side validation being bypassed and the potential for malicious users to manipulate the HTML form. To mitigate these risks, it is recommended to perform server-side validation in PHP to ensure data integrity and security.

// Server-side validation example
$name = $_POST['name'];

// Check if name is not empty
if(empty($name)){
    echo "Name is required";
} else {
    // Process the input data
}