How can PHP be used to pass form data to another page with a different layout?

To pass form data to another page with a different layout using PHP, you can use the $_POST superglobal array to retrieve the form data submitted by the user, store it in variables, and then redirect the user to the new page while passing the data as URL parameters or using sessions. On the new page, you can access the passed data and display it in the desired layout.

<?php
// Retrieve form data using $_POST
$name = $_POST['name'];
$email = $_POST['email'];

// Redirect to the new page with form data as URL parameters
header("Location: new_page.php?name=$name&email=$email");
exit;
?>