6.3 HTML form submission

In standard usage, HTML forms are a “client-server” technology. The “client” is a web browser, like Firefox, which is responsible for displaying the electronic form and allowing the user to enter data into the form. The “server” is a web server (e.g., Apache), and it is responsible for checking the data that was entered into the form and for storing the data somewhere (e.g., in a database). The web server is typically on a different computer from the browser, either on a local network, or somewhere on the world-wide-web.

The action attribute of the form element is used to specify the program to which the form data is sent. This can be just the name of a program (commonly, the name of a script in a language such as Perl or Python or PHP), in which case the program must reside in the same directory as the file of HTML code that describes the form, or it can be a full URL that provides a path to such a program (i.e., the HTML code and the processing code can reside on separate computers).

The method attribute of the form element is used to specify what format the form data are sent in. This attribute can have the value "get" or "post". For online surveys or data entry, "post" is probably the more appropriate option.

The disadvantage of the standard usage of HTML forms is that it requires a separate computer and it requires web server software. The set up of a web server is beyond the scope of this book, but Section 6.4.2 describes one way to achieve input checking and data storage without the need for external programs (i.e., just with a browser).

The “local submission” described in Section 6.4.2 can be used for learning how to create HTML forms and for testing an HTML form, but for serious survey administration and data entry it will be necessary to set up a proper web server and data processing program. These services are provided by several online sites if the necessary expertise is not locally available.

Paul Murrell

Creative Commons License
This document is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 License.