This seems so simple but I can't remember how I've done it before.
Using PHP I'm posting a form from mysite.com/?x=y and want the resulting page to be mysite.com/?x=y&formx=formy...
Options I've tried don't quite give the desired result:
action - setting action="?x=y"
clears the get variables if method="get"
in place of those in the form. Prior knowledge of the get variables are also required.
method - although it seems logical to set method="get"
, this passes the form variables but clears any placed in action. Setting method="post"
retains the current get variables but doesn't add the form variables/values.
Hidden field(s) - All get variables/values can be in hidden fields with method="get"
. This requires prior knowledge of the get variables and a lot of duplication if there are a lot of variables or forms. This so far is the closest solution.