How can HTML be prevented in a form using PHP?

To prevent HTML from being submitted in a form using PHP, you can use the `htmlspecialchars()` function to convert any HTML characters to their corresponding HTML entities. This will ensure that any HTML tags submitted in the form data will be displayed as plain text on the webpage, rather than being interpreted as HTML code.

// Prevent HTML in form input
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    $input_data = htmlspecialchars($_POST["input_data"]);
    
    // Process the sanitized input data
}