Amazon.com: PC Books || Educational Software || Magazines
Amazon: Books-CA || Software-CA || Books-UK || Software-UK

HTML | Javascript | ASP | PHP | VBScript | SQL | Hardware | PC FAQ| WinXP|

Learn to Build, Upgrade, or Repair your Computer Ebook + PC Safety 101 kwwebservice.com Reasonably priced web development & hosting
ASP Basics
Introduction
Variables & Arrays
Sub & Functions
If Statements
Case Statements
Loop Statements
Date Objects
Form Processing
Text File Objects
Database Access
Adding Record
Updating Record
Deleting Record
Virtual Includes
Cookies
Server Variables
Creating Login Page
E-mail
ASP Books @
CA Amazon
UK Amazon
US Amazon

  :: Home
PC Topics
  :: Build A PC
  :: Windows XP
  :: PC Help
Tutorials
  :: HTML
  :: JavaScript
  :: ASP
  :: PHP
  :: VBScript
  :: SQL
Miscellaneous
  :: Code/Scripts
  :: Forum
  :: Links
  :: Contact us
  :: Tell A Friend
  :: In Somali
  ::
Web Articles
  Top Web Hosting
Reviews
  Processing
Online Card Payment Guide
  Domain name
registration & buying guide
  Getting
a website online guide
  Search Engine
submission & optimization tips
Netfirms Web Hosting
Free trial
Quality business correspondence.
Yahoo! Search Marketing

Processing forms using ASP

You can process HTML forms using these two powerful ASP objects, Response and Request.  Response outputs the value to a page and Request retrieves values from an object.  Take a look at the following example:
<form name="userForm" method="post" action="userForm.asp">
  Enter a user name: <input type="text" name="userName" size="20">
  Enter a password: <input type="password" name="password" size="20">
  <inpute type="submit" name="submit" value="Send">
</form>
Result

Enter a user name:

Enter a password:

We just created HTML form and tell the browser to process the form using the file "userForm.asp".  The following is userForm.asp file that writes the values from the form.
<html>
<head>
<title>Process form Info</title>
</head>
<body>
You have typed the user name <%=Request.Form("userName")%> and the password <%=Request.Form("password")%>.
</body>
</html>
Type something in the text boxes and hit submit button to see the result of this example.  What you will see is the result of this code.   The form will pass the information to userForm.asp file, which then will use the power of Request to write this information.

Form Processing Example 2

You can store value retrieved from form into variables in order to use these value whatever way you want.  Take a look at this example which is little bit more complex then previous one.
<html>
<head>
<title>Form Example 2</title>
</head>
<body>
<p><b>This example process basic form elements</b>
<form method="POST" action="formProcess.asp">
<p>Your name: <input type="text" name="Name" size="20"><br>
Status: <input type="radio" value="Customer" name="status">Customer   <input type="radio" name="status" value="Visitor">Visitor<br>
Do you own any of these trucks:<br>
<input type="checkbox" name="truck" value="Land Cruiser">Land Cruiser<br>
<input type="checkbox" name="truck" value="Sequoia">Sequoia<br>
<input TYPE="checkbox" name="truck" value="4Runner">4Runner<br>
<input TYPE="checkbox" name="truck" value="Highlander">Highlander<br>
<input TYPE="checkbox" name="truck" value="Tundra Access Cab">Tundra Access Cab<br>
Car of Choice:<select size="1" name="product">
<option value="MR2 Spyder">MR2 Spyder</option>
<option value="Celica">Celica</option>
<option value="Matrix">Matrix</option>
<option value="Avalon">Avalon</option>
<option value="Camry">Camry</option>
<option value="Corolla">Corolla</option>
<option value="Echo">Echo</option>
<option value="Prius">Prius</option>
<option value="RAV4 EV">RAV4 EV</option>
</select><br>
Enter some general comments about what you think about Toyota cars:<br>
<textarea rows="5" name="Comments" cols="50"></textarea><br>
<align="center"><input type="submit" value="Submit" name="submit"><br>
</form>
</body>
</html>
Code for formProcess.asp
<html>
<head>
<title>Result of your information</title>
</head>
<body>
<%
dim name, status, truck, car, comments
name=Request.Form("Name")
status=Request.Form("status")
car=Request.Form("car")
comments=Request.Form("comments")
truck=Request.Form("truck")
%>
Your name: <b><%=name%></b><br>
Status: <b><%=status%></b><br>
Your favourite car is: <b><%=car%></b><br>
You currently own these trucks:<b> <%=truck%></b><br>
Your comments about Toyota products:<b><%=comments%></b>
</body>
</html>
Test this code on your own server. Our server does not support asp.

Loops File Objects
Listed @ ConsumerVote.com - The Consumer Rated Web Directory
PC Articles
  Computer Safety
prevent viruses & Spyware