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

Passing Data with Hidden Fields by Charles Carroll

This page demonstrates how to have several pages that are forms yet after all pages are filled out the final form has access to all inputs without session variables.

surveypage1.asp asks the user the first questions:

   filename=/learn/test/surveypage1.asp

<Test Script Below>


<html><head>
<TITLE>surveypage1.asp</TITLE>
</head>
<body bgcolor="#FFFFFF">
<form action="surveypage2.asp" method="post">
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>

surveypage2.asp asks the user the next questions:

   filename=/learn/test/surveypage2.asp

<Test Script Below>


<html><head>
<TITLE>surveypage2.asp</TITLE>
</head>
<body bgcolor="#FFFFFF">
<form action="surveypage3.asp" method="post">
<%
first=request.form("first")
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="hidden" name="first" value="<%=first%>">
<input type="hidden" name="last" value="<%=last%>">
<input type="submit" value="Next Question ->"></p>
</form>
</body></html>

surveypage3.asp asks the user yet some more questions:

   filename=/learn/test/surveypage3.asp

<Test Script Below>


<html><head>
<TITLE>surveypage3.asp</TITLE>
</head>
<body bgcolor="#FFFFFF">
<%
first=request.form("first")
last=request.form("last")
haircolor=request.form("haircolor")
favoritecolor=request.form("favoritecolor")
%>
<form action="surveypage3respond.asp" method="post">
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="hidden" name="first" value="<%=first%>">
<input type="hidden" name="last" value="<%=last%>">
<input type="hidden" name="haircolor" value="<%=haircolor%>">
<input type="hidden" name="favoritecolor" value="<%=favoritecolor%>">

<input type="submit" value="Final Step ->">
</form>
</body></html>

surveypage3respond.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.