I have a URL : foo.php?name=adam&lName=scott
, and in foo.php
I have a form which gives me values of rectangleLength
& rectangleBreadth
with a submit button.
When I click this submit button with form action as $_SERVER['REQUEST_URI']
, I get this result URL: foo.php?rectangleLength=10&rectangleBreadth=5
(these values have been filled in by the user).
Notice that I am losing my previous values name
& lName
from the URL.
How can I keep them?
Also, keep in mind that I have to come back to foo.php
and if the user wants to submit the form again then the length and breadth values should change.
Best Answer
You can add two hidden fields in the form on the first target site, blabla.php in your case:
For a dynamic solution, use a foreach loop:
You may consider locking the dynamic approach down to a list of known possible keys: