</>
Skip to content
ASP lessons (11/40)

ASP — Forms

HTML Form

<form method="post" action="process.asp">
    <input type="text" name="username">
    <input type="password" name="password">
    <input type="submit" value="Login">
</form>

Get Form Data

<%
Dim username
username = Request.Form("username")

Dim password
password = Request.Form("password")

Response.Write("Username: " & username)
%>

Request.Form vs Request.QueryString

MethodDescription
Request.FormPOST data
Request.QueryStringURL parameters

Form Validation

<%
Dim username
username = Request.Form("username")

If username = "" Then
    Response.Write("Username is required")
Else
    Response.Write("Welcome, " & username)
End If
%>

Multiple Values

<select name="colors" multiple>
    <option value="red">Red</option>
    <option value="blue">Blue</option>
    <option value="green">Green</option>
</select>
<%
Dim colors
colors = Request.Form("colors")

Dim color
For Each color In colors
    Response.Write(color & "<br>")
Next
%>

Mini Practice

  1. Create an HTML form
  2. Get form data
  3. Validate input
  4. Handle multiple values

Up Next

Continue with Cookies — working with cookies.

Related Topics

Frequently Asked Questions about Forms

What is Forms in ASP?

Forms is a fundamental concept in ASP. This lesson explains it step by step with clear examples, making it easy for beginners to understand.

How do I learn Forms?

Start by reading the explanation above, then try the code examples. Practice by modifying the examples and experimenting with different values. Hands-on practice is the best way to learn Forms.

Why is Forms important in ASP?

Forms is essential for ASP development. Understanding this concept will help you write better code and solve real-world problems more effectively.