KidsLovePC Contact Us
  Home   PHP  Graphics ASP  JavaScript   J2EE  HTML  JAVA   Swing   Webtip  Forums  Lyric  Free sheet music  Ringtones

Example2: Now assume that for this baseball, everyone needs a team uniform. Your task is to collect size,color from team players.

Programming used: CollectInformation.asp, DealCollection.asp

CollectInformation.asp
<html>
<head>
<title> Form for Uniform</title>
</head>
<body>
<H1> Base ball uniform</h1>
<h3>Please fill in this form and press submit</h3>
<Form action="dealcollection.asp" method=post>
Your name<input type="text" name="name">
Your size:S, M, L, XL:<input type="text" name="size"></p>
Your color <input type="text" name="color"></p>
<Input type="reset" value="Start over">
<input type="submit" value="Save my preferences" ></p>
</form>
</body>
</html>

How it works: The above code produces 2 text boxes named "size" and "color", along with Submit and Reset button. The resulting form is send to DealCollection.asp.

DealCollection.asp

<html>
<head>
<title>Uniform information</title>
</head>
<body>
<%
Dim strName,strSize,strColor
strName=Request.Form("name")
strSize=Request.Form("size")
strColor=Request.Form("color")
%>
<h1>BaseBall uniform Order
</h1>

<% Response.write strName %> ordered the following uniform:<br>

Color= <% Response.write strColor %><br>
Size=<% Response.write strSize %><br>
</body>
</html>

How is works:
Name size and color are passed in the form object and saved in local string variables: strName,strSize and strcolor. The information is then displayed using the Response.Write method.

Saving the information
In the previous example we saved the information as follows:

<%
Dim strName,strSize,strColor
strName=Request.Form("name")
strSize=Request.Form("size")
strColor=Request.Form("Color")
%>


We retrieve the information from the Form object by using Request.Form(XXX) and save it in the local variables for later use.

Displaying the information back to user

In the DealCollection.asp we displayed the saved information using the Response.write method as follows:


<%Response.write strName%>
<%Response.write strSize%>
<%Response.write strColor%>


ASP tutorial
What is ASP
Install IIS
VBScript or JScript
ClientSide vs ServerSide scripting
ASP execution order
Dealing with Form
More Form example
Variable &Variant
String
Local variable
Global variable
Arrays
Use if_then_else
Use Select Case
For_Next loop
Do_while loop
Subroutine vs Function
Request Object
QueryString
Count Keyword
Using QueryString
Application, Method, Events
Create Virtual Directory
Save array in Application
Session, Method, Events
Using Cookie
Server Object
Ad Rotator
Content Linker
Browser
Dictionary object
Filesystemobject Object

 

 

 

Best books about ASP & ASP.Net from Amazon
Beginning Dynamic Websites : with ASP.NET Web Matrix (Programmer to Programmer) (Paperback) Build Your Own ASP.NET Website Using C# & VB.NET (Build Your Own) (Paperback) Professional Active Server Pages 3.0 (Programmer to Programmer) (Paperback) ASP.NET Cookbook (Paperback) ASP.NET Kick Start (Paperback)

 

Printer Inkjet A Z lyricsLearn ChineseHome|PHP|Swing|HTML|JavaScript|ASP|JAVA|Forum|WebTip|Contact Us
Copyright © kidslovepc.com All rights reserved(new). Privacy|Copyright
designed by info@kidslovepc.com

Please help us cover the web site maintenance fee.
barcode scanner Thermal Printer credit card machine bar code printer