How can PHP be used to dynamically generate and display content on a new page based on user input?

To dynamically generate and display content on a new page based on user input, you can use PHP to capture the user input, process it, and then redirect the user to a new page displaying the dynamically generated content.

// Capture user input
$user_input = $_POST['user_input'];

// Process user input (e.g. perform calculations, fetch data from a database)
$dynamic_content = 'Hello, ' . $user_input . '!';

// Redirect user to a new page with dynamically generated content
header("Location: new_page.php?content=" . urlencode($dynamic_content));
exit;