What is the role of GET and ECHO in passing values from one page to a contact form in PHP?
When passing values from one page to a contact form in PHP, you can use the GET method to retrieve values from the URL parameters and the ECHO function to display those values in the form fields. This allows you to pre-fill the form with the data passed from the previous page.
// Retrieve values from URL parameters using GET method
$name = $_GET['name'];
$email = $_GET['email'];
// Display values in the contact form using ECHO
<input type="text" name="name" value="<?php echo $name; ?>">
<input type="email" name="email" value="<?php echo $email; ?>">
Keywords
Related Questions
- How important is it for PHP developers to stay updated on discussions and resources related to session security in forums and online communities?
- How can the php_value directive in .htaccess be used to modify PHP settings like upload_max_filesize?
- How can time zone differences impact the accuracy of timestamp rounding in PHP?