Senin, 09 Februari 2009

Passing Forms as Query Strings

The first thing to notice about this form is the method="get" attribute. Up to this point we have used the POST method of transmitting form information. This method, recall, transmits the name/value pairs from the form to the server as a separate data stream from the URL request in the ACTION attribute. In this instance, the GET method transmits the name/value pairs as a query string appended to the URL in the ACTION parameter.

The reason for using the GET method in this application is for consistency with the previous item category links. Those links pass a chosen category of products to the search.asp page as a query string. This form does the same thing for the keyword search. When the visitor enters a word or phrase into the text box and clicks the submit button, a URL in the form,

search.php?Criterion=value
is issued and the value in the text box is paired with the name Criterion for transmission to the server. Thus, when either a category name or a keyword is received by the search.php page, both will be in the form of a query string, differing only in their names and values:

search.php?Category=value from the link
search.php?Criterion=value from the form.

Note also that the text box is valued with the value of the Criterion query string that is transmitted to the server when the form is submitted:

input type="text" name="Criterion" class="textbox" size="12"
value=""

When this form is submitted, a URL is issued for the search.asp page, passing to it the query string containing the value entered into this field. Remember, also, that the menu.inc file of which this form is a part appears on all pages, including the search.asp page. Therefore, when the search.asp page is loaded, along with this form contained in the menu.inc file, the text box reflects the Criterion value that is passed to the page. So the value shows up in the text box even though it is in a different form on a different page!

------------------------------------------


Related:


single-record
Trik Cara Melacak IP
Trik Choose Phone
Trik woodwork-stores
Trik woodwork supplies
Trik wood work tool
Using radio button vb2008
Valentineday
vb2008 with control
vb2008 with control properties
vb2008 with oriented programming
VB.NET Solution files
VB.NET Code myclass