next up previous contents
Next: Entering Data Up: Forms: Facilitating User Input Previous: Some Example Forms

The FORM Tag

The <FORM> tag defines a environment where other HTML contents are placed to create the form.

Any tag which is allowed inside of the <BODY> container is allowed inside a form.

This tag has two attributes which must be used if the form is to work correctly.

METHOD
has two possible values:

ACTION
attribute contains the URL of the CGI program which processes the data sent by the browser. The value of ACTION can be either a relative or a full URL.
The action attribute can also be a URL to an email address or such thing.

Here's what an empty form would look like:

   <FORM method="post" 
         action="/cgi-bin/program1.pl">

   </FORM>

In the example above, we assume the CGI program (program1.pl) resides in the cgi-bin directory of the server which contains the form itself.

A form that would email you directly could look like this:

<FORM METHOD="POST" 
      ACTION="mailto:your email address">

The tags added to HTML to allow for HTML forms
are: 

<FORM>. . . </FORM> 
       Define an input form.
       Attributes: ACTION, METHOD, ENCTYPE 
<INPUT> 
       Define an input field.
       Attributes: NAME, TYPE, VALUE, CHECKED, SIZE, MAXLENGTH 
<SELECT> . . . </SELECT> 
       Define a selection list.
       Attributes: NAME, MULTIPLE, SIZE 
<OPTION> 
       Define a selection list selection (within a SELECT). 
       Attribute: SELECTED 
<TEXTAREA> . . . </TEXTAREA> 
       Define a text input window.
       Attribute: NAME, ROWS, COLS


next up previous contents
Next: Entering Data Up: Forms: Facilitating User Input Previous: Some Example Forms
dave@cs.cf.ac.uk