ASP Source Code

ASP File: vbscript/general/form/form.asp

 
   ASP Script
   Comments
   HTML and Text

<html>

<head>
<title>Form Sample</title>
</head>

<body BGCOLOR="#eadfdf">

<h3><br>
Form Sample</h3>

<hr>
<%
'On Error Resume Next

If Request.Form("hname") = "" Then

    ' This part of the script allows a person
    ' to enter data on an HTML form.
%>


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

<form METHOD="POST" ACTION="form.asp">
   <input type="hidden" name="hname" value="hvalue"><p>Your Name: </p>
   <p><input TYPE="TEXT" SIZE="50" MAXLENGTH="50" NAME="name"><br>
   </p>
   <p>Movies that you like: (you may select more than one) <select NAME="movies" MULTIPLE
   SIZE="3">
     <option SELECTED> The Lion King </option>
     <option> Beauty and the Beast </option>
     <option> 101 Dalmations </option>
   </select> <br>
   </p>
   <p>Why do you like the movies you've selected? </p>
   <p><textarea NAME="describe" ROWS="5" COLS="35"></textarea><br>
   </p>
   <p><input TYPE="SUBMIT" VALUE="Submit Form"><input TYPE="RESET" VALUE="Reset Form"> </p>
</form>
<%   Else

    ' This part of the script shows a person
    ' what was selected.
%>

<%   If Request.Form("name") = "" Then %>

<p>You did not provide your name. <%   Else %>  </p>

<p>Your name is <b><%= Request("NAME") %></b> <%   End If %>  <%   If Request("Movies").Count = 0 Then %>  </p>

<p>You did not select any movies. <%   Else %>  </p>

<p>The movies you like are: <b><%= Request("Movies") %></b> <%   If Request.Form("describe") = "" Then %>  </p>

<p>You did not say why you like the movie(s) you have selected. <%   Else %>  </p>

<p>Your description of why you like the movie(s) is: <i><b><%= Request.Form("describe") %></b></i> <%   End If %>  <%   End If %>  <%   End If %>  <br>
<br>
</p>
</body>
</html>