HTML Forms

  • A form uses the formelement
  • A form uses two attributes: methodand action
  • Attribute methodspecifies how the form’s data is sent to the web server (e.g., HTTP POST or GET method)
  • The actionattribute of the form element specifies the scriptto which the form data will be sent
  • Input element

  • The input element provides data to the script that processes the form
  • The usage of input element is determined by the value of type attribute.
  • The input type=text inserts a text box into the form, which allows the user to input data
  • Most input elements have an associated name attribute
  • The size attribute specifies the number of characters visible in the input element
  • Optional attribute maxlength limits the number of characters input into a text box
  • The input type=submit submits the data entered in the form to the web server for processing
  • The input type=reset allows a user to reset all form elements to their default values
  • The input type=hidden creates hidden inputs not visible to users
  • Radio Button

    Radio buttons let a user select ONE of a limited number of choices

    Drop-Down List

    The 'select' element defines a drop-down list.

    Textarea Element

    The 'textarea' element defines a multi-line input field (a text area),rows defined number of rows, columns defined number of columns.

    Button Element

    The button element defines a clickable button