How do I maintain state between pages

T

Terri

Hi All,

I'd like to build a series of pages with next and back buttons that a user
could enter data in. I'd like the data to be maintained if for example the
user goes from page1 to page2 and then back to page1.

I believe I could create hidden form fields on the pages and then post the
forms data back and forth until my user gets to the last page when all the
variables are submitted to a database.

Is this an acceptable way to do this? If there are other ways what are the
pros and cons?

What about if the user uses the browsers next and back buttons? Will the
results be different if they use next and back buttons that are created on
my pages?

Is there a better newsgroup where I could post this question??

Thanks for any help.
 
S

Stretch

Terri said:
I believe I could create hidden form fields on the pages and then post the
forms data back and forth until my user gets to the last page when all the
variables are submitted to a database.

Is this an acceptable way to do this? If there are other ways what are the
pros and cons?

Good article on this topic:

http://support.microsoft.com/?kbid=175167

HTH-J
 
N

news.microsoft.com

HI there!
I believe you can use session as:
session("XXX") = VALUEX

so now you can use you pages:
response.write session("XXX")
or attribute to something:
varJ = session("XXX")

bye.
VILMAR
BRAZIL
 
C

Chris Barber

To be a little more concise (using the .Contents() method of the Session
object implicitly is not a good idea):

Session.Contents("NAME") = "YourValue"

To output this session variable to the page from ASP use:

This is the value of the session variable '<%=Session.Contents("NAME")%>'.

or (I find this easier to use):

<%
Dim pstrOutput
pstrOutput = Session.Contents("NAME")
%>
This is the value of the session variable '<%=pstrOutput%>'.

or:

<%
Dim pstrOutput
pstrOutput = Session.Contents("NAME")
Response.Write "This is the value of the session variable '" & pstrOutput &
"."
%>

Depends on what you want to do of course.

You can also use client-side persistence passing querystrings around (and
indeed, querystrings will also work server-side of course).

Chris.

HI there!
I believe you can use session as:
session("XXX") = VALUEX

so now you can use you pages:
response.write session("XXX")
or attribute to something:
varJ = session("XXX")

bye.
VILMAR
BRAZIL
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,190
Latest member
Martindap

Latest Threads

Top