|
Forms Introduction by Charles
Carroll
Forms are the primary way that a user feeds information
into ASP. A form is a web page that contains tags that cause the browser to show fields
that the user can fill in.
- Forms can be HTML files. They only need to be ASP
if ASPy type capabilities are needed (session variables, includes).
- The form must pass the variables onto a .asp file to process
the form.
- An excellent form tutorial can be found at:
http://www.mountaindragon.com/html/forms.htm
Form with GET
<form action="x.asp"
name="whatever" method=get>
....
<input type=submit>
<input type=reset>
</form>
- there is a limit on the number of characters
(approximately 4,000 but varies depending on server and browsers
involved.
- The form will show it's parameter in the
browser address window, for example:
testform.asp?state=md&city=Germantown
would be the URL in the browser, if the state and city field were populated.
- An ASP script picks up a form field with:
<%whatever=request.querystring("whichfield")%>
Form with POST
<form action="x.asp"
name="whatever" method="post">
....
<input type=submit>
<input type=reset>
</form>
- It supports many more characters than get
(megabytes of data in case of file uploads)
- The form will not show it's parameter in the
browser address window, for example:
http://whatever.com/testform.asp
would be the only URL in the browser, regardless of how many fields and how
much data is passed.
- An ASP script picks up the form field with:
<%whatever=request.form("whichfield")%>
Tips:
Tip #1: If using response.redirect to
simulate a GET don't forget to encode:
/freebook/asp/encode.aspx
Tip #2: A text link
can be used intead of a button to
post above form would look like this:
<a href="javascript:document.yourformname.submit();">
send data</a>
 |  |  |
 |
There are many worthy charities!!. But perhaps help starving children in Africa or South America AND help Charles too.
a $5 tip buys him lunch at McDonalds,
a $20 tip buys his kid Hitoshi a new computer game,
a $39 tip buys his daughter Michiko a few nice outfits.
See our donor list.
|  |
 |  |  |
|
|
|
|