|
If you know the name of an input in the form submitted,
you can get the value the visitor entered from the Request collection.
|
Request is a VB variable declared as a collection.
The Request collection is filled with all the data
that can be found in either Standard-In or the Server Variables.
If you know the name of an input in the form submitted,
you can get the value the visitor entered from the Request collection.
As in the SampleMain example, the Request collection gets loaded
by calling the LoadRequest procedure.
The example sends the contents of the Request collection as an HTML page.
Run the script and you will see data arranged
as a set of Name/Value Pairs or Terms.
Most likely, all the data you see is from a set of terms called Server Variables.
Some of the data is about the browser and some is about the server.
This script is worth keeping.
You can use it for analyzing requests.
Add the text ?Testing onto the end of the URL
you enter in your browser to run this script.
The resulting URL should look like this.
http://255.128.64.32/cgi-bin/samplemain/samplemain.exe?Testing
In the resulting HTML page, look at the value of QUERY_STRING.
The value should be Testing.
QUERY_STRING is set to whatever follows the question mark.
QUERY_STRING is just what an HTML form generates.
As an example, write an HTML page
that contains a simple form like the one in Yahoo's home page.
Set the Action attribute of the Form tag to the URL of the SampleMain script.
Name a text box Search.
The page might look something like this.
<html>
<form
action="http://255.128.64.32/cgi-bin/samplemain/samplemain.exe">
<input type=text name=Search>
<input type=submit value="Submit">
</form>
</html>
Do not put Method="POST" in the Form tag.
We'll try that one later.
Point your browser at this page, type Testing in the text box, and submit it.
Again, look for QUERY_STRING in the resulting HTML page.
The value should be Search=Testing.
The more inputs you add to the form, the more terms go in QUERY_STRING.
|
You don't have to worry about interpreting QUERY_STRING.
VBWeb does that for you.
|
There are separators between the terms and various other special codes.
But you don't have to worry about interpreting QUERY_STRING.
VBWeb does that for you.
Look closely at the resulting HTML page
and you will find Search=Testing on its own.
The same goes for any other inputs you might have added.
In addition to Server Variables and QUERY_STRING,
there are two more sources of terms for the LoadRequest procedure:
Cookies and Standard-In.
Cookies are terms your web server stores with a visitor's browser.
If no sites on your web server have sent cookie terms to the current visitor,
then no cookie terms will be in the Request collection.
Standard-In is an alternative to QUERY_STRING.
Standard-In is preferred over QUERY_STRING
because QUERY_STRING has a limited length.
To send a request through Standard-In instead of QUERY_STRING,
put the attribute Method="POST" into the Form tag.
Standard-In gets interpreted by the LoadRequest procedure
just like QUERY_STRING.
|