Anti-Moronic Posted November 6, 2010 Share Posted November 6, 2010 Say I have this query: site.com?var=1 ..I have a form with 'var2' field which submits via get. Is there a way to produce: site.com?var=1&var2=formdata I was hoping there would be a quick way to affix, but can't find any info. Also, the query could sometimes be: site.com?var2=formdata&var=1 I would have to produce: site.com?var2=updatedformdata&var=1 Is my only option to further parse the query? Quote Link to comment Share on other sites More sharing options...
jl5501 Posted November 6, 2010 Share Posted November 6, 2010 You would need to store the original GET name/values as hidden fields in the second form, which would then be alongside the form values when submitted. Incidently, you could use POST for the second form in this case, and your original GET values will be part of the POST data Quote Link to comment Share on other sites More sharing options...
Anti-Moronic Posted November 6, 2010 Author Share Posted November 6, 2010 I see. Thanks! Love to use POST but I will need to save the entire query using get so can be obtained via the url. I'll give a shot and let you know if I have any problems. Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted November 6, 2010 Share Posted November 6, 2010 You could use $_SERVER['QUERY_STRING']. Quote Link to comment Share on other sites More sharing options...
Anti-Moronic Posted November 6, 2010 Author Share Posted November 6, 2010 Thanks Pikachu - I am already parsing the query string but whereas my other variables are set via the actual query string, this is set via the form and must be. Therefore, the GET overwrites my previous query string. I've used the hidden form elements which is working fantastic! I will likely add a layer and abstract the whole thing later but for now it's working so I can reduce priority. Thanks again! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.