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;
Keywords
Related Questions
- How can user input values be securely passed from one PHP script to another for processing?
- What are some common reasons for a form submission resulting in a blank page, particularly in Internet Explorer versions?
- How can you retrieve the auto_incremented ID assigned by the database after an INSERT operation in MySQL using PHP?