Forms

A webform on a web page allows a user to enter data that is sent to a server for processing.

A form in HTML is by far the most common way to use a form online.

The following elements can make up the user-inputting portion of a form:

  • input field

    • text — a simple text box that allows input of a single line of text (an alternative, password, is used for security purposes, in which the characters typed in are invisible or replaced by symbols such as *)
    • checkbox — a check box
    • radio — a radio button
    • file — a file select control for uploading a file
    • reset — a reset button that, when activated, tells the browser to restore the values to their initial values.
    • submit — a button that tells the browser to take action on the form (typically to send it to a server)
  • textarea — much like the text input field except a textarea allows for multiple rows of data to be shown and entered
  • select — a drop-down list that displays a list of items a user can select from

When data that has been entered into HTML forms is submitted, the form control names and values are encoded and sent to the server in an HTTP request message using method GET or POST.

The HTML form learns where to pass the data (from the action attribute of the form's HTML element). The target PHP file then retrieves the data either through POST or GET (see HTTP for more information), depending on the programmer's preference.

The tabindex attribute

Using the tabindex attribute, you can "force" the tab to jump to the next logical form element.

Post A Comment

Anti-Spam Quiz: