Jump to content

Building persistent SELECT string


mjsulliv
 Share

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".

Edited by thescientist
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...