How can PHP be used to fill out a form via URL?
To fill out a form via URL using PHP, you can pass the form values as query parameters in the URL and then use PHP to extract those values and populate the form fields accordingly. This can be useful for pre-filling form fields with data from a previous page or external source.
<form action="submit_form.php" method="post">
<input type="text" name="username" value="<?php echo isset($_GET['username']) ? $_GET['username'] : ''; ?>">
<input type="email" name="email" value="<?php echo isset($_GET['email']) ? $_GET['email'] : ''; ?>">
<input type="submit" value="Submit">
</form>
Keywords
Related Questions
- What are some considerations when using PHP and Smarty together to display sorted category data in an admin panel interface?
- How can the md5 function be used to create random strings in PHP?
- How can the use of IDs in a loop from a database affect the functionality of multiple countdown instances on a webpage?