COMP 1850 | HTML Forms Processing

Since forms are used for gathering data form the user it is crucial for there to be a processing script that can do something useful with the data. Deploying a functional form online involves two stages:

  1. The form shell is the HTML code that creates the form and form inputs (also called 'fields', 'form controls', 'widgets'...) used to gather data from the user.
  2. The processing script is a server-side script that does something with the data (validates a user login, searches a database for relevant results, etc)

IMPORTANT: Server side processing scripts will only function when they are running on an HTTP server that supports the scripting language used. You cannot test a form processing script directly in your client browser, it must be over HTTP or HTTPS

Form Methods

All form elements must apply a method to determine how the form data will be sent from the client to the server.

There are two methods to choose from:

  1. GET - Use this for forms that do NOT include private or personal user information. Form data wil lbe appended to the request URL as a query string. Useful for allowing user to bookmark the results of a form submission.
  2. POST - Use this for forms that involve private or personal user data (eg: login with passwords, making purchase with credit card number). Form data will be inserted into the HTTP header.

IMPORTANT: Neither method GET or POST are secure or encrypted. All web transactions should be over HTTPS to ensure encryption and security.

See code and comments on this page for more details.

A Form Using method="get"



A Form Using method="post"