$name = htmlentities($_POST['name'], ENT_QUOTES, 'UTF-8');
$email = filter_var($_POST['email'], FILTER_VALIDATE_EMAIL); if ($email === false) { echo "Invalid email address entered."; }
$phone_number = filter_var($_POST['phone_number'], FILTER_SANITIZE_NUMBER_INT);This code uses the filter_var() function to sanitize the phone number entered by the user via the POST method. It removes all characters except digits from the input value. This function helps to prevent various types of attacks based on user input, such as XSS attacks. Package library: Base Input