If you want to add interactivity to your site, then you can use HTML forms. HTML forms interact with CGI scripts to collect data, record information, or simply involve your readers with your Web page. Forms are made of text boxes, check boxes, radio buttons, drop-down lists, and other input fields.
<form> </form>
The <form> tag is the primary tag that surrounds all forms on a Web page. According to the HTML 4.0 specification, this tag is required for form elements to be displayed on a Web page.
You can place the <form> tag anywhere within the <body> of an HTML document, and all input tags, select tags, and textarea tags must be contained within it.
The <form> tag has the following attributes:
- action (required)
This attribute tells the browser where the CGI is located that will process this form. Normally, this is a Perl script or other program located on the Web server, but you can use email to send the form results. For example:<form action="mailto:webdesign.guide@about.com">
The only time you would leave out this attribute is if you were using an onclick or other JavaScript method to access the form.
- method
This can be either get or post. This is the method that the browser will use to communicate to the Web server and send the form information.get - the default, this method puts the form information in the URL after a question mark. For example: [blockquote shade=yes]http://www.server.com/cgi-bin/test.pl?name=value
post - this method sends the form information as a data block to the server through HTTP protocols.[/blockquote]
- enctype
This indicates the format of the data submitted to the server. This is most often used with forms where there is a file-upload option. The default isapplication/x-www-form-urlencoded. However, if you want to do file-upload you must use the encoding typemultipart/form-datato ensure that your files will be transferred correctly.
- accept
This is a list of the MIME types that the server will accept.
- accept-charset
This is a list of the character sets that the server will accept.
- onsubmit
If you want to perform JavaScript validation on your form, then you need to have a JavaScript call within the form tag. The onSubmit attribute tells the browser to complete a JavaScript script before submitting the form to the server.
Part 2 of the HTML Forms Tutorial: The Input Tag
This covers the tags that you use to build a form, including input tags, radio buttons, and check boxes.

