How can form data be passed to a script in PHP?

To pass form data to a script in PHP, you can use the `$_POST` superglobal array to access the data sent from a form using the POST method. You can then process this data within your PHP script to perform actions like saving it to a database or displaying it on a webpage.

<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    $name = $_POST['name'];
    $email = $_POST['email'];
    
    // Process the form data as needed
}
?>

<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
    <input type="text" name="name">
    <input type="email" name="email">
    <button type="submit">Submit</button>
</form>