Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8

Thread: multi page form

  1. #1
    Regular Coder
    Join Date
    Mar 2006
    Posts
    187
    Thanks
    5
    Thanked 0 Times in 0 Posts

    multi page form

    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

  • #2
    Regular Coder
    Join Date
    Mar 2007
    Posts
    505
    Thanks
    1
    Thanked 19 Times in 19 Posts
    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.

    UTILIZATION:

    To enable: session("thisVar") = request.form("thisVar")

    To destroy:
    EITHER

    session("thisVar") = ""

    OR

    Session.Contents.Remove("thisVar")
    To say my fate is not tied to your fate is like saying, 'Your end of the boat is sinking.' -- Hugh Downs
    Please, if you found my post helpful, pay it forward. Go and help someone else today.

  • #3
    Regular Coder
    Join Date
    Mar 2006
    Posts
    187
    Thanks
    5
    Thanked 0 Times in 0 Posts
    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?

  • #4
    Regular Coder
    Join Date
    Mar 2007
    Posts
    505
    Thanks
    1
    Thanked 19 Times in 19 Posts
    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.
    To say my fate is not tied to your fate is like saying, 'Your end of the boat is sinking.' -- Hugh Downs
    Please, if you found my post helpful, pay it forward. Go and help someone else today.

  • #5
    Regular Coder
    Join Date
    Mar 2006
    Posts
    187
    Thanks
    5
    Thanked 0 Times in 0 Posts
    what about them timing out? is that just as good as destroying them?

  • #6
    Regular Coder
    Join Date
    Mar 2007
    Posts
    505
    Thanks
    1
    Thanked 19 Times in 19 Posts
    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.
    To say my fate is not tied to your fate is like saying, 'Your end of the boat is sinking.' -- Hugh Downs
    Please, if you found my post helpful, pay it forward. Go and help someone else today.

  • #7
    Regular Coder
    Join Date
    Mar 2006
    Posts
    187
    Thanks
    5
    Thanked 0 Times in 0 Posts
    hmm yeah, but its a search, so it contains no personal information, and it would be nice if the user could go back and modify their search later on. could i use cookies on the users computer, but divert to session variables if they have cookies disabled?

  • #8
    Regular Coder
    Join Date
    Mar 2007
    Posts
    505
    Thanks
    1
    Thanked 19 Times in 19 Posts
    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.

    HTH!
    To say my fate is not tied to your fate is like saying, 'Your end of the boat is sinking.' -- Hugh Downs
    Please, if you found my post helpful, pay it forward. Go and help someone else today.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •