Welcome to Bucaro TecHelp!

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 RSS News Feeds News Feeds

Victims of Sandy Hook

Stop the Slaughter of Innocents. Congress is bought and paid for by gun lunatics and gun promotion groups. If you want to live in a safe America, help buy Congress back for America. Send a donation to Mayors Against Illegal Guns, 909 Third Avenue, 15th Floor New York, NY 10022


Retrieving Form Data With ASP

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.

RSS Feed RSS Feed

Follow Stephen Bucaro Follow @Stephen Bucaro

Fire HD
[Site User Agreement] [Privacy Policy] [Site map] [Search This Site] [Contact Form]
Copyright©2001-2017 Bucaro TecHelp 13771 N Fountain Hills Blvd Suite 114-248 Fountain Hills, AZ 85268