Search Search

#1 worldwide
FREE Coding Lessons

since 1996
   THE BEST WAY to learn ASP & Asp.net!
Advertise Here!
click for details
Credits Host:
DiscountASP.net
Server Admin:
The "Team"
Contact Info.
Charles M. Carroll

my Blog
[prev. Lesson]  Pass Data w/Cookies
     [next Lesson]  Pass Data w/ID tied to database

Passing Data with Sessions 
   by Darren Gorvett 
(darren.gorvett@raidnet.co.uk)

ASP sessions are another way to pass the data.

surveypage1s.asp asks the user the first questions:

   filename=/learn/test/surveypage1s.asp

<Test Script Below>


<html>
<head>
<TITLE>surveypage1s.asp</TITLE>
</head>
<body bgcolor="#FFFFFF">
<form action="surveypage2s.asp" method="post" id=form1 name=form1>
First Name<br>
&nbsp;&nbsp;&nbsp;
<input type="text" name="first" size="20"><br>
Last Name<br>
&nbsp;&nbsp;&nbsp;
<input type="text" name="last" size="20">
<p>&nbsp;&nbsp;&nbsp;
<input type="submit" value="Next Question ->"></p>
</form>
</body>
</html>

surveypage2s.asp asks the user the next questions:

   filename=/learn/test/surveypage2s.asp

<Test Script Below>


<html>
<head>
<TITLE>surveypage2s.asp</TITLE>
</head>
<body bgcolor="#FFFFFF">
<form action="surveypage3s.asp" method="post" id=form1 name=form1>
<%
session("first")=request.form("first")
session("last")=request.form("last")
%>
Hair Color<br>
&nbsp;&nbsp;&nbsp;
<input type="text" name="haircolor" size="20"><br>
Favorite Color<br>
&nbsp;&nbsp;&nbsp;
<input type="text" name="favoritecolor" size="20">
<p>&nbsp;&nbsp;&nbsp;
<input type="submit" value="Next Question ->"></p>
</form>
</body>
</html>

surveypage3s.asp asks the user yet some more questions:

   filename=/learn/test/surveypage3s.asp

<Test Script Below>


<html>
<head>
<TITLE>surveypage3s.asp</TITLE>
</head>
<body bgcolor="#FFFFFF">
<%
session("haircolor")=request.form("haircolor")
session("favoritecolor")=request.form("favoritecolor")
%>
<form action="surveypage3srespond.asp" method="post" id=form1 name=form1>
Street Address<br>
&nbsp;&nbsp;&nbsp;
<input type="text" name="street" size="20">
<br>
City<br>
&nbsp;&nbsp;&nbsp;
<input type="text" name="city" size="20"><br>
State<br>
&nbsp;&nbsp;&nbsp;
<input type="text" name="state" size="20">
<br>
Zip<br>
&nbsp;&nbsp;&nbsp;
<input type="text" name="zip" size="20">
<br>
&nbsp;&nbsp;&nbsp;
<input type="submit" value="Final Step ->" id=submit1 name=submit1>
</form>
</html
</body>

surveypage3srespond.asp gathers all the answers and responds:

   filename=/learn/test/surveypage3respond.asp

<Test Script Below>


<html><head>
<TITLE>surveypage3respond.asp</TITLE>
</head>
<body bgcolor="#FFFFFF">
<%
first=request.form("first")
last=request.form("last")
haircolor=request.form("haircolor")
favoritecolor=request.form("favoritecolor")
street=request.form("street")
city=request.form("city")
state=request.form("state")
zip=request.form("zip")
%>
Thanks for all your information<br>
We are happy to meet you <%=first%>&nbsp;<%=last%><br>
We know your hair color is <%=haircolor%><br>
and your favorite color is <%=favoritecolor%><br>
and we will ship all items to<br>
<%=first%>&nbsp;<%=last%><br>
<%=street%><br>
<%=city%>&nbsp;<%=state%>&nbsp;<%=zip%>
</body></html>

There are many worthy charities!!. But perhaps help starving children in Africa or South America AND help Charles too. a $5 tip buys him lunch at McDonalds, a $20 tip buys his kid Hitoshi a new computer game, a $39 tip buys his daughter Michiko a few nice outfits. See our donor list.