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:
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.
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.