ID: Q191565
The information in this article applies to:
This article explains one possible way to write Active Server Pages (ASP) code using VBScript to provide a recursive functionality within your ASP page.
Recursive means that the ASP page will call itself to continue with functionality. In the example below the page will post form values to itself for processing. This is by no means necessary in all applications, it is merely provided as a more robust method to achieve functionality. One advantage to this method is fewer ASP pages to maintain. For example a developer could make a self-contained "wizard" all in one ASP page.
This sample demonstrates the functionality with one post to itself.
Place this code in a plain text document and save it as "Recursive.asp."
   =========
   <%@ LANGUAGE="VBSCRIPT" %>
   <%
      submitted = Request.Form("frmSubmit")
   %>
   <HTML>
   <HEAD>
   <TITLE>Recursive Example</TITLE>
   </HEAD>
   <BODY>
   <%
   If submitted <> "yes" Then
   %>
   <h3>Recursive Example</h3>
   <form action="<%=Request.Servervariables("SCRIPT_NAME")%>" method="post"
                                                             name="myForm">
   <input type="hidden" name="frmSubmit" value="yes">
   Please enter some text:<br><input type="text" name="frmInput"><p>
   <input type="submit" name="myButton" value="Click here to continue">
   </BODY>
   </HTML>
   <%
    ElseIf submitted = "yes" Then
   %>
   <h3>Form Has been submitted</h3>
   This is the information you submitted:<p>
   <%=Request.Form("frmInput")%>
   </BODY>
   </HTML>
   <%
   End If
   %>
Keywords          : kbASP kbGrpASP 
Version           : WINDOWS:2.0; WINNT:
Platform          : WINDOWS winnt
Issue type        : kbhowtoLast Reviewed: August 26, 1998