Welcome to my ASP Code Website

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!">
</form>

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

ASP Form Creation and Security