I have a URL with one GET parameter. I am trying to post a simple form, basically to simply add one more GET parameter to the URL.
Current URL: mysite.com/page.php?first=123
Form HTML:
<?php $first = $_GET['first']; ?>
<form method="get" action="page.php?first=<?php echo $first; ?>">
<input type="text" name="second"><br>
<input type="submit" value="Submit"><br>
</form>
I'm trying to get the URL to be: mysite.com/page.php?first=123&second=456
However, when submitting the form, the page URL drops the first GET parameter and changes to: mysite.com/page.php?second=456
How can I submit this form and add the second GET parameter to add onto the end of the URL after the first already existing GET parameter?
Thanks
You need to use hidden input instead:
<input type="hidden" name="first" value="<?php echo htmlspecialchars($first, ENT_QUOTES); ?>" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With