What are common pitfalls when implementing a PHP contact form, especially for beginners?

One common pitfall when implementing a PHP contact form is not properly sanitizing user input, which can leave your form vulnerable to malicious attacks like SQL injection. To solve this issue, always use functions like `htmlspecialchars()` or `mysqli_real_escape_string()` to sanitize user input before using it in your code.

// Sanitize user input before using it
$name = htmlspecialchars($_POST['name']);
$email = htmlspecialchars($_POST['email']);
$message = htmlspecialchars($_POST['message']);

// Example of using mysqli_real_escape_string()
$name = mysqli_real_escape_string($conn, $_POST['name']);
$email = mysqli_real_escape_string($conn, $_POST['email']);
$message = mysqli_real_escape_string($conn, $_POST['message']);