Jump to content

Building persistent SELECT string


mjsulliv

Recommended Posts

I have an application that builds a query string for a sql db. The user indicates via a set of check boxes on a web page what column-data (SELECT criteria) to return to the query. The app has several form pages, each with its own set of the same check boxes. Upon reload each page returns to its original state with the check boxes cleared and the user must re-indicate the criteria each time the query is submitted.There are two things I would like to improve. I would like simplify the site by using a single SELECT criteria page that would allow the users to set them and all subsequent queries would use these values and I would like the values to stay persistent, at least during that session.At first I just thought I’d use a global javascript array to remember the values and pass them to the server via the $_POST array; but as there seems to be no mechanism for js to affect php variables (and I should know that by now) I’m left to choosing between $_Session variables or cookies it seems. The app does not currently use cookies and I don’t have a strong familiarity with using them. I’m already using $_Session for other purposes but this seems un-elegant. I’d appreciate some insight to this issue.--- Mike

Link to comment
Share on other sites

what is the unique natures of each page that warrants the same check boxes on each page, and yet still requires a new page? It might be worthwhile to create an object in PHP's $_SESSION to store the query values for each page, using a unique identifier for that page as the index. Once the user reaches the end of the form, you can parse each of these "query's" and remove duplicates, or whatever it is you're trying to do. This would help you preserve the options selected for each page, while representing each query in it's user selected state, so that you can analyze, interpret, and parse them at the "end".

Link to comment
Share on other sites

Each of the pages have a different set of selector-elements which are use to build the WHERE portion of the query. I've been banging on this for a while and have a version that uses the $_SESSION array to maintain the values.Thanks for the response.--- Mike

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...