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? Link to comment https://forums.phpfreaks.com/topic/217937-affixing-form-get-query-to-end-of-existing-query/ 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 Link to comment https://forums.phpfreaks.com/topic/217937-affixing-form-get-query-to-end-of-existing-query/#findComment-1131069 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. Link to comment https://forums.phpfreaks.com/topic/217937-affixing-form-get-query-to-end-of-existing-query/#findComment-1131070 Share on other sites More sharing options...
Pikachu2000 Posted November 6, 2010 Share Posted November 6, 2010 You could use $_SERVER['QUERY_STRING']. Link to comment https://forums.phpfreaks.com/topic/217937-affixing-form-get-query-to-end-of-existing-query/#findComment-1131071 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! Link to comment https://forums.phpfreaks.com/topic/217937-affixing-form-get-query-to-end-of-existing-query/#findComment-1131072 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.