Web pages can contain forms intended to allow a user to provide data to be submitted to a program (an agent) for processing. The program may be on the same machine as the browser (on the "client-side") or on some other computer that serves web pages or mail messages or database accesses (on the "server-side"). For information on client side forms, see the discussion of Javascript Forms.
The rules for HTML forms are specified by the World Wide Web Consortium (W3C) in section 17 of the HTML specification ( http://www.w3.org/TR/html401/interact/forms.html#h-17.1).
A form element delimits any section of an HTML web page containing ordinary HTML markup (headings, paragraphs, tables, lists ...) between <form> and </form> tags and controls that a user can use to provide data.
There are two methods used by HTML forms to communicate with server-side programs: "get" and "post".
A simple version of a form to invoke a cgi-bin program named "myaction.py" belonging to a user named "myuser" on machine "mymachine.mycompany.mydomain" using cgiwrap to ensure security would be
<form
action="http://mymachine.mycompany.mydomain/cgi-bin/cgiwrap/myuser/myaction.py"
method="get">
...
</form>
In addition to regular HTML, the available controls to put into a form are:
These controls are created in a web page using the HTML elements:
Here is an example of a web page to provide two character names to a script named cgistory4.py:
<html> <head> <title>Put yourself and a friend in the story</title> </head> <body> <form action=http://arcib.dowling.edu/cgi-bin/cgiwrap/bernsteh/cgistory4.py method="GET"> Name of first character: <input type=text name=arg1 value="Fred" /><br /> Name of second character: <input type=text name=arg2 value="Mary" /><br /> <input type="submit" value="format story"> </form> </body> </html>
which produces: