In this article, you learn how to create some basic html forms and how to use ASP to retrieving data from forms. You also learn how to convert the from's data to numerical values if you need to use it in calculations, and more.
Welcome to Bucaro TecHelp!

Welcome to Bucaro TecHelp!
Maintain Your Computer and Use it More Effectively
to Design a Web Site and Make Money on the Web

About Bucaro TecHelp About BTH User Agreement User Agreement Privacy Policy Privacy Site Map Site Map Contact Bucaro TecHelp Contact Advertise on Bucaro TecHelp Advertise Here RSS News Feeds News Feeds


Hello World! Computer Programming for Kids and Other Beginners

Hello World! Computer Programming for Kids and Other Beginners

This book provides a gentle but thorough introduction to computer programming. It's written in language a kid can follow, but anyone who wants to learn how to program a computer can use it. Even adults.

Teaches using the powerful object-oriented but easy-to-use open source Python programming language.

Click Here

Retrieving Form Data With ASP

By Stephen Bucaro

We are all familiar with those forms on the web where you type some information into a text box, set a checkbox, or select an item in a list, and then click on the Submit button to send the information off to the server. An HTML form allows a webpage to display input fields and controls where users can enter data and submit it to the server. The HTML code for an example form is shown below.

<form>
Name: <input type="text" name="name"><br>
Email: <input type="text" name="email"><br>
Message: <textarea name="message"></textarea><br>
<input type="submit" name="submit" value="Submit">
</form>

The code above would create a typical; contact form. After the user enters the appropriate data in the form's fields and clicks on the Submit button, the browser will construct a querystring containing the names and contents of the forms two text boxes and the textarea. The querystring will be appended to the webpage's URL.

For example, if the user entered the name "Bob Sled", the email address "bsled@dmn.com" and the mesage "good morning", the URL with the querystring appended would be as shown below.

http://domain.com/page.asp?name=Bob+Sled&email=bsled@dmn.com&message=good+morning

This line would appear in the browsers address bar. Note that the querystring is separated from the URL with a question mark, and the querystring consists of name=value pairs separated by ampersands. Spaces are replaced with plus signs.

It's interesting to know that you can test your asp form processing code by typing the URL?querystring directly into the browsers address bar, or by formatting the URL?querystring as a link and clicking on it. The form is not required.

This example used the <form> tag with no attributes. In that case the form is submitted to the same webpage that contains the form. You could submit the form to a different webpage by adding the "action" attribute to the <form> tag, as shown below.

<form action="http://domain.com/process_from.asp">

This example submitted the form with the default get method. Form data submitted by the get method can be read by a server-side ASP script using the Request.QueryString method as shown below.

Dim strName, strEmail, strMessage
strName = Request.QueryString("name")
strEmail = Request.QueryString("email")
strMessage = Request.QueryString(""message")

There are several things to consider when submitting a form with the get method. Some older browsers and web servers limit how long a querystring can be. the querystring is visible in the browser's address bar. If the form contains hidden data or the user enters a password, these will be visible to anyone standing near the screen.

Programming Sections

RSS Feed RSS Feed

Active Server Pages


[Site User Agreement] [Advertise on This site] [Search This Site] [Contact Form]
Copyright©2001-2011 Bucaro TecHelp 13771 N Fountain Hills Blvd Suite 114-248 Fountain Hills, AZ 85268