Using ASP to Process Forms

Using ASP to Process Forms
ASP is perfect for processing forms of all kinds, from polls to mail forms to guestbooks and much more. Here are instructions on having ASP get information from a form.

First, of course, you need the form set up. A form is a regular HTML statement, so visit the BellaOnline HTML Site if you don't understand HTML forms. Let's do a simple yes/no poll. So the syntax for the poll form would be:

<B>Should Chocolate Be Banned?</B>
<form action="polls_p.asp" method="post">
<input type="radio" name="vote" value="YES"> YES
<input type="radio" name="vote" value="NO"> NO
<input type="submit" name="Vote!" value="Vote!">

OK, you have your form, and it points to polls_p.asp for its processing. Now you want to build your polls_p.asp page to actually do something with this user's vote.

So the very first thing you have to do is get whatever choice they made! You do that with the REQUEST command. The name of the field is vote. So all you do is say

Vote = Request("vote")

That's it! Now you have a variable called Vote, and in it is either YES or NO. It's just a matter of using that with your database commands! You can do that with as many fields as you wish, so your form could have say 20 fields and be a complex application form. You just REQUEST each field one by one and put each into a variable.

Inserting Into a Database with ASP
Updating a Database with ASP

Introduction to ASP Ebook

Download this ebook to get everything you need to know about learning ASP - from a step by step tutorial to function lists, sample code, common errors and solutions, and much more! 101 pages.

Related Articles
Editor's Picks Articles
Top Ten Articles
Previous Features
Site Map

Content copyright © 2022 by Lisa Shea. All rights reserved.
This content was written by Lisa Shea. If you wish to use this content in any manner, you need written permission. Contact Lisa Shea for details.