07-04-2007, 11:12 PM
i am developing a search facility for my website, however, i want to split the search options over 6 seperate pages, each page will have the following buttons previous,search & next. how could i implement it, so that when next or previous is clicked, the data in the form is stored unitl the user clicks search? I will have all 6 pages in one asp page, using the query string to call each page, that is not a problem. However storing the data until the user clicks submit is!
One idea i have, is to store the data from each page in a varible of some sort, and then pass that varible from page to page by using the post method of the form. I could use hidden fields, but i feel that might get too messy!
Any ideas would be great! Thanks
07-05-2007, 03:12 PM
Instead of using straight variables (which are destroyed once the page is loaded) and the POST/querystrings, use session variables.
Session variables persist throughout until the browser is closed or they are specifically destroyed.
To enable: session("thisVar") = request.form("thisVar")
session("thisVar") = ""
07-05-2007, 04:37 PM
Sorted! cheers. i dunno y i dint think of that. is there a limit of how many session variales you can use per visitor or in total?
07-05-2007, 05:25 PM
There is not in number, but in amount of memory. You have to remember that session variables are stored on the server, not the client.
Just make sure to destroy the variables when you are done with them, and you won't run into any problems.
07-06-2007, 10:56 PM
what about them timing out? is that just as good as destroying them?
07-07-2007, 03:33 AM
Timing out can be considered the same thing, but it doesn't necessarily release them from memory when the user is done, because they may or may not be connected.
Session timeouts, by default in ASP, are 10 minutes in duration. You can set that limit to more (or less) by using the Session.Timeout method.
Your best bet is to, upon submitting your form, spend the extra 3 minutes in coding to destroy your session variables to release them from memory. It also ensures that someone doesn't return later (by using the Back button, think of every site that you log into - they ALWAYS ask you to close your browser when finished to ensure that someone doesn't come along behind you and "re-login") and "steal" some of your information by looking at the session variables/form postings.
07-07-2007, 06:37 PM
07-07-2007, 11:44 PM
Could you? Yes... But would you really want to? What are people searching for that they need 6 pages ( or would need to refine later )?
Setting up cookies is a valid method, and will persist past browser closing.
It's up to you what you want to do, but 6 pages of detail, with cookies or session variables, is a bit long.