How can PHP be used to redirect to a specific HTML page based on form submission?

To redirect to a specific HTML page based on form submission in PHP, you can use the header() function to send a raw HTTP header to the browser. You can check the form submission using $_POST or $_GET superglobals and then redirect the user to the desired HTML page using the header() function with the "Location" parameter set to the URL of the page.

<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    // Check if the form was submitted
    if (isset($_POST['submit'])) {
        // Redirect to a specific HTML page
        header("Location: specific_page.html");
        exit();
    }
}
?>