Process a simple contact form and validate inputs.
Source Code
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$name = htmlspecialchars($_POST['name']);
$email = filter_var($_POST['email'], FILTER_VALIDATE_EMAIL);
$message = htmlspecialchars($_POST['message']);
if ($name && $email && $message) {
// Process the form data, like sending an email
echo "Thank you for your message, $name.";
} else {
echo "Please fill in all the fields correctly.";
}
}