How to keep already-set GET parameter values on form submission?
You can add two hidden fields in the form on the first target site, blabla.php in your case:
<form ...> <input type="hidden" name="name" value="<?php echo htmlspecialchars($_GET['name']);?>"> <input type="hidden" name="lName" value="<?php echo htmlspecialchars($_GET['lName']);?>"> <!-- rest of the form here --></form>
For a dynamic solution, use a foreach loop:
<?phpforeach($_GET as $name => $value) { $name = htmlspecialchars($name); $value = htmlspecialchars($value); echo '<input type="hidden" name="'. $name .'" value="'. $value .'">';}?>
You may consider locking the dynamic approach down to a list of known possible keys:
<?php$keys = array('name', 'lName', ...);foreach($keys as $name) { if(!isset($_GET[$name])) { continue; } $value = htmlspecialchars($_GET[$name]); $name = htmlspecialchars($name); echo '<input type="hidden" name="'. $name .'" value="'. $value .'">';}?>
A simpler solution to keep the URL unchanged by using http_build_query
<form action="<?php echo $_SERVER["PHP_SELF"] . '?'.http_build_query($_GET); ?>" ... .. ..
There are different ways to do this. All of them write the parameters they receive into a file, memory, or a database and retrieve them later with a key
The easiest method is something like a session variable: http://php.net/manual/en/features.sessions.php
The main setup is something like this (caution: that is unsecure code, make sure you only add session variables you want to keep, and sanitize user input!):
<?phpsession_start();foreach ($_GET as $key=>$value) { $_SESSION[$key]=>$value;}?>
and now, as long as the user does not close the browser, you can access these variables with $_SESSION[varname];