F.10.5- Sample 03 - Looping Data by Appending the URL
by NT Community Manager.
|
| << F.10.4- Sample Hidden 02 - Two Page Questionnaire | AppendixF | F.11.0- Text Areas >> |
Sample 03 – Looping Data by Appending the URL
LoopingData01Form.asp uses a related technique to actually append the data to the URL in the same manner that the form sends data to the server. In this case we must make the form an ASP page, so that it can extract the data from the Request object:
...
<BODY>
<H3>LoopingData 01 Form</H3>
<FORM ACTION="LoopingData01Response.asp" METHOD=GET NAME="Form1">
Kids Page - Ages 12 and under only<BR>
*You must provide your date of birth and nickname*
<BR>Please type your Last name
<INPUT NAME="NameLast" VALUE=<%=Request.QueryString("NameLast")%>><BR>
Please type your Nick name
<INPUT NAME="NameNick" VALUE=<%=Request.QueryString("NameNick")%>><BR>
Please type your Birthdate
<INPUT NAME="DOB"><BR>
<INPUT TYPE="SUBMIT" VALUE="Submit Query">
</FORM></BODY>
...
|
|
The response page is LoopingData01Response.asp:
...
<BODY>
<H3>LoopingData 01 Response</H3>
<%varNameLast = Request.QueryString("NameLast")
varNameNick = Request.QueryString("NameNick")
varDOB = Request.QueryString("DOB")
If varNameNick="" Then
varBack = "LoopingData01Form.asp"
varBack = varBack & "?NameLast=" & varNameLast
Response.Redirect(varBack)
End If
If Not isdate(varDOB) Then
varBack = "LoopingData01Form.asp"
varBack = varBack & "?NameLast=" & varNameLast
varBack = varBack & "&NameNick=" & varNameNick
Response.Redirect(varBack)
Else
If DateDiff("yyyy",varDOB,Date())>=13 Then
varBack = "LoopingData01Form.asp"
varBack = varBack & "?NameLast=" & varNameLast
varBack = varBack & "&NameNick=" & varNameNick
Response.Redirect(varBack)
Else
Response.Write "We have received your name as "
Response.Write varnameNick & " " & varNameLast
Response.Write " born on " & varDOB
End If
End If
%>
</BODY>
...
|
And the result is:
|
|
| << F.10.4- Sample Hidden 02 - Two Page Questionnaire | AppendixF | F.11.0- Text Areas >> |

RSS



