objnoob Posted March 1, 2011 Share Posted March 1, 2011 Greetings, I'm looking for a way to pass a query string (from page1) as part of a query string (to page2) as a single key=>value pair. The idea is the use the query string to return the user to the previous page after the action has been completed. query results[page1]->view record/action selection[page2]->back to results[page1] I'm sure someone has been down this path before. P.S. the script is all contained within one file, thus the filename.ext is already known. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/229256-query-string-into-single-value/ Share on other sites More sharing options...
Muddy_Funster Posted March 1, 2011 Share Posted March 1, 2011 If you are actioning the transit between pages with a form you can add your $query variable to a hidden field in the form, and catch it with $_POST on the other side. alternatives would be to use a session variable to pass the data, or to use URL passing and $_GET to retieve it on the second page Quote Link to comment https://forums.phpfreaks.com/topic/229256-query-string-into-single-value/#findComment-1181298 Share on other sites More sharing options...
monkeytooth Posted March 1, 2011 Share Posted March 1, 2011 From one page to the next? like you click a link and go to the next page? Or you want it stored in general in a way you speak for all pages? Either way store it as an array in a session or cookie, if that dont work as a straight array try serializing and unserializing them and storing them in cookies/sessions.. Quote Link to comment https://forums.phpfreaks.com/topic/229256-query-string-into-single-value/#findComment-1181299 Share on other sites More sharing options...
objnoob Posted March 1, 2011 Author Share Posted March 1, 2011 Yes, I would like to use URL passing but I want to pass the queryString (multiple key=>value pairs) as a single key=>value pair that can then be parsed back out to multiple pairs. Keeps things tidy. Quote Link to comment https://forums.phpfreaks.com/topic/229256-query-string-into-single-value/#findComment-1181312 Share on other sites More sharing options...
objnoob Posted March 2, 2011 Author Share Posted March 2, 2011 Instead of sending the referring queryString to the next page via URL, I just capture it using $_SERVER['HTTP_REFERER'] and parse out the queryString which I include in the form has a hidden input. Once the data is submitted for processing, if all is well I use the queryString to build landing page. This way user goes from qualified list of records -> to edit record form -> back to list of records qualified in the same manner. Less secure then my intent to manually pass the referring queryString via URL, but it works. Quote Link to comment https://forums.phpfreaks.com/topic/229256-query-string-into-single-value/#findComment-1181837 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.