asp is fun


The ASP On Line Course:
Using the REQUEST Object



ASP is very commonly used to process form requests - having the user type in something, and then either mailing or storing or writing this information out. Learn more about how the request object works and how to use it to boost your website's functionality.

The REQUEST object is a way that information is passed from one webpage to another. Usually this is done by creating a link that looks something like this:

http://www.aspisfun.com/SendMessage.asp?username=Lisa&email=lshea@xxxxxx.net

The ? after the URL lets your code know that anything after the ? is values for you to work with. Each name-value pair is separated by an &. You can have as many pairs as you wish.

This same syntax is generated by a GET type of form. To create this, you would create a form something like this on a webpage:

<FORM action="SendMessage.asp" method="GET>
What is your username? <INPUT TYPE="TEXT" NAME="username">
What is your email address? <INPUT TYPE="TEXT NAME="email">

So in essence, the form is just like any regular HTML form. You can now use your ASP script to process the results of the form, and do whatever you want with that information.

Let's take a look at the SendMessage.asp file that this information is being sent to - either by a direct URL link or through this form. It's very easy to get your hands on that incoming information!

UserName = Request("username")
EmailAddress = Request("email")
Response.write "The username submitted is: " & UserName
Response.Write " and the email address submitted is: " & EmailAddress

That's it! Just use Request(fieldname) to get your hands on the value in any fieldname being passed in. You can then use this information to send mail messages, write information to the database, customize your webpages, and much, much more.

ASP Course and Code | HTML Tips, Code & Help | Java Code & Help | Gaming Walkthroughs

 



About Lisa's Sites

This LisaShea site is one of over twenty sites I own and run. The key focus of each of my sites is to help visitors improve their lives and find joy in each day. Many of my books' proceeds are donated to charity. I have been online since the early '80s, began publishing in 1987, and have now published over 300 books.
Use my Site Map to get started!
Be the change you wish to see in the world.