|
To access the contents, click the chapter and section titles.
Platinum Edition Using HTML 4, XML, and Java 1.2
CHAPTER 8
|
Adding a </FORM> tag immediately after creating a <FORM> tag is a good practice; then you can go back to fill in the contents. Following this procedure helps you avoid leaving off the closing tag after you finish. Many of todays popular HTML editing programs take care of placing the </FORM> tag for you, so be sure to check to see if the editor youre using does this. |
Each HTML form has three main components: the form header, one or more named input fields, and one or more action buttons.
The form header and the <FORM> tag are actually one and the same. The <FORM> tag takes the six attributes shown in Table 8.1. The ACTION attribute is required in every <FORM> tag.
Table 8.1 Attributes of the <FORM> Tag | |
---|---|
Attribute | Purpose |
ACCEPT | Specifies a list of MIME types that the server will process correctly |
ACCEPT-CHARSET | Provides a list of character sets that are acceptable to the server |
ACTION | Specifies the URL of the processing script |
ENCTYPE | Supplies the MIME type of a file used as form input |
METHOD=GET|POST | Tells the browser how it should send the form data to the server |
TARGET | Gives the name of the frame where the response from the form submission is to appear |
ACTION is set equal to the URL of the processing script so that the browser knows where to send the form data after it is entered. Without it, the browser has no idea where the form data should go. A full ACTION URL has the following form:
protocol://server/path/script_file
You can also use a relative URL if you are calling a script on the same server.
METHOD specifies the HTTP method to use when passing the data to the script and can be set to values of GET or POST. When youre using the GET method, the browser appends the form data to the end of the URL of the processing script. The POST method sends the form data to the server in a separate HTTP transaction.
METHOD is not a mandatory attribute of the <FORM> tag. In the absence of a specified method, the browser uses the GET method.
CAUTION:Some servers might have operating environment limitations that prevent them from processing a URL that exceeds a certain number of characterstypically one kilobyte of data. This limitation can be a problem when youre using the GET method to pass a large amount of form data. Because the GET method appends the data to the end of the processing script URL, you run a greater risk of passing a URL thats too big for the server to handle. If URL size limitations are a concern on your server, you should use the POST method to pass form data.
Previous | Table of Contents | Next |
Products | Contact Us | About Us | Privacy | Ad Info | Home
Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc. All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Read EarthWeb's privacy statement. |