Best method of collecting/storing info over a number of pages

Posted on 2005-04-25
Last Modified: 2010-04-07
I have a number of pages each containing a form.

I want to collection information from each form and at the end of the process, after completing the last form, write the data into a database.

What is the best way to store the information as the user goes from page to page?

Question by:gilkesy
    LVL 2

    Accepted Solution

    Well, depends on what you're most comfortable with, how much data you want to pass and how many forms you want to go through.

    A lot of programmers will use session variables, which works for a few items, is unique to the user and is pretty flexible.

    So, on the first page assign values

    Session.Item("formtextValue1") = formitem.text 'value in a text box
    Session.Item("formddlValue1") = formddl.selectedvalue 'value in a ddl

    Then, those values can be used throughout your application, including creating your SQL insert--Just keep adding session variables.  The session variables will get destroyed if they close their browser or the session times out before you write to the DB.

    Depending on the complexity of your application, you may also consider writing to the DB as you go.  For example, on the first page, write the bits you have collected to your table (including some unique ID), then on the next page, either insert/update the record until you have collected everything you need.  The good thing about this is that you can either resume a set of forms if they leave or get disconnected and you can see where people are abandoning the app, and possibly follow up with them to finish it.  Also, if you need to look at the values at the end of your app, you just pull from the DB instead of session.

    Hope that helps.
    LVL 4

    Expert Comment

    I agree with the above techniques and generally use session variables myself (assuming you don't need to store a large amount of data or store the data for a long time, as this will drain your server memory, especially for large array list and other collections).

    Just to add onto his answer though, instead of writing to a database, you can always use cookies (although some people don't have them enabled, this is a rarity).  This is a much faster method and requires no server-side storage and it has most of the benefits of storing on a database.

    Author Comment

    Ok, thanks!

    I will use session variables this time and may explore cookies at a later date.


    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
    ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now