STARTING AND ENDING A FORM

    print $query->startform(-method=>$method,
			    -action=>$action,
			    -encoding=>$encoding);
      <... various form stuff ...>
    print $query->endform;

	-or-

    print $query->startform($method,$action,$encoding);
      <... various form stuff ...>
    print $query->endform;

startform will return a <FORM> tag with the optional method, action and form encoding that you specify. The defaults are: method: POST action: this script encoding: application/x-www-form-urlencoded

endform returns the closing </FORM> tag.

Startform's encoding method tells the browser how to package the various fields of the form before sending the form to the server. Two values are possible:

application/x-www-form-urlencoded
This is the older type of encoding used by all browsers prior to Netscape 2.0. It is compatible with many CGI scripts and is suitable for short fields containing text data. For your convenience, CGI.pm stores the name of this encoding type in $CGI::URL_ENCODED.

multipart/form-data
This is the newer type of encoding introduced by Netscape 2.0. It is suitable for forms that contain very large fields or that are intended for transferring binary data. Most importantly, it enables the ``file upload'' feature of Netscape 2.0 forms. For your convenience, CGI.pm stores the name of this encoding type in $CGI::MULTIPART

Forms that use this type of encoding are not easily interpreted by CGI scripts unless they use CGI.pm or another library designed to handle them.

For compatibility, the startform method uses the older form of encoding by default. If you want to use the newer form of encoding by default, you can call start_multipart_form() instead of startform().

JAVASCRIPTING: The -name and -onSubmit parameters are provided for use with JavaScript. The -name parameter gives the form a name so that it can be identified and manipulated by JavaScript functions. -onSubmit should point to a JavaScript function that will be executed just before the form is submitted to your server. You can use this opportunity to check the contents of the form for consistency and completeness. If you find something wrong, you can put up an alert box or maybe fix things up yourself. You can abort the submission by returning false from this function.

Usually the bulk of JavaScript functions are defined in a <SCRIPT> block in the HTML header and -onSubmit points to one of these function call. See start_html for details.