You are here:  NetStrider » Tutorials » HTMLRef » Commands » FORM «

HTML Reference Guide

Author: Randy D. Ralph.   In place March 1, 1999.   Copyright © 1999 NetStrider.   Presented as a public service.

BACK <FORM> Command next

Command Syntax:

<FORM command parameters >
  Form Elements
</FORM>

Defines and contains a form which can be used to gather user input, format it and process it according to provided parameters and included form elements.

See also:  <INPUT>, <OPTION>, <SELECT>, <TEXTAREA>.

Command Parameters:

action="URL"

Defines an URL to which the output of the form is directed.  This is generally a CGI script or some other program capable of processing the information gathered by the form.  The access protocol set for the target URL, along with the enctype and method command parameters determine the way in which gathered information is submitted and processed.

If no action parameter is included, then the URL of the HTML document which includes the form, itself, becomes the target of the form.

enctype="data encoding format"

Defines the format to be used to transmit user form responses to the host server if the protocol provided by the action command parameter does not require a specific format.  Generally, this parameter is not necessary if data is MIME encoded.

method="get|post"

Defines the method by which the form contents will be transmitted to the host server.

Where:

  • get -
    is the default method - may require an enctype.
  • post -
    is the generally preferred method which formats data using MIME encoding type application/x-www-form-urlencoded.
     
Form Elements:
Follow the links below to learn more about form elements:

<INPUT command parameters>

<OPTION command parameters></OPTION>

<SELECT command parameters></SELECT>

<TEXTAREA command parameters>

Example:
<FORM method="post" action="http://www.netstrider.com/tutorials/cgi-bin/gform"> Name: <INPUT type="text" name="Name" size=40><br> Email: <INPUT type="text" name="EMaddress" size=40><br> Site Name: <INPUT type="text" name="PTitle" size=40><br> URL: <INPUT type="text" name="URL" size=40> <INPUT type="submit" value="Send"> </FORM> Yields -
Name:
Email:
Site Name:
URL:

  • Defines a form which contains five data input elements that solicit information from the form user.

  • Declares that the form method is post.

  • Declares that the URL to which the form output should be directed is ../cgi-bin/gform.  This would submit the form output to the program gform for processing.
Forms and form elements can be included within tables for precise alignment of components to produce a more pleasing effect.

Forms cannot be nested one within another, but a single web page can contain multiple forms.

Return to Section E:H


Return to the List of Commands
Author: Randy D. Ralph.  In place March 1, 1999.  Copyright © 1999 NetStrider.  World Rights reserved.




Hosted by uCoz