How can PHP be integrated with HTML forms to capture user input and generate dynamic URLs for navigation purposes?
To integrate PHP with HTML forms to capture user input and generate dynamic URLs for navigation purposes, you can use the $_GET superglobal array to retrieve form data and use it to dynamically generate URLs. You can then use this dynamic URL to navigate to different pages based on user input.
<?php
if(isset($_GET['user_input'])) {
$user_input = $_GET['user_input'];
$dynamic_url = "page.php?input=" . $user_input;
header("Location: $dynamic_url");
exit();
}
?>
<form method="GET" action="">
<input type="text" name="user_input">
<button type="submit">Submit</button>
</form>