Form Sample

<% @ Language="JavaScript" %>

<HTML>
<HEAD><TITLE>
Form Sample</TITLE></HEAD>

<BODY>

<H3>Form Sample</H3>

<HR>

<%

if (Request.ServerVariables("CONTENT_LENGTH") == 0) {

%>

This sample shows how to use the Request collection to get information from a posted form.

<FORM METHOD="POST" ACTION="form.asp">
     Your Name: <INPUT TYPE="TEXT" NAME="name">
     Movies that you like: (you may select more than one)
     <SELECT NAME="movies" MULTIPLE SIZE="3">
          <OPTION VALUE="Star Wars">Star Wars</OPTION>
          <OPTION VALUE="Antz">Antz</OPTION>
          <OPTION VALUE="Gone with the Wind">Gone with the Wind</OPTION>
     </SELECT>
     Why do you like the movies you've selected?
     <TEXTAREA NAME="describe"></TEXTAREA>
     <INPUT TYPE="Submit" NAME="Submit Form">
     <INPUT TYPE="Reset" NAME="Reset Form">
</FORM>

<%
}
else {
     if (Request("name") == "") {
%>

You did not provide your name.

<%
     }
     else {
%>

Your name is <B><% = Request("name")  %></B>

<%
     }
%>

<%
     if (Request("movies").Count == 0) {
%>

You did not select any movies.

<%
     }
     else {
%>

The movies you like are: <B><% = Request("movies")  %></B>

<%
          if (Request("describe") == "") {
%>

You did not say why you like the movie(s) you have selected.

<%
          }
          else {
%>

Your description of why you like the movie(s) is:
<I><B><% = Request("describe")  %></B></I>

<%
          }
%>

<%
     }
%>

<%
}
%>

</BODY>
</HTML>