Forms

Forms are used when requesting data from the user to perform an action. Common forms often found on websites are:

  • πŸ”“ a login form
  • πŸ§‘ a sign-in form
  • πŸ”‘ a password forgot form
  • πŸ’΅ a checkout form
  • πŸ”Ž a search/filter form
  • πŸ€– a captcha form

There are two HTTP methods commonly used in forms: GET and POST. There is a semantic use πŸ—ΊοΈ: GET is used by forms "getting" data from the server (search/filter forms), POST is used by forms creating something server-side (all others forms). In practice, it's up to the developer.

Forms are commonly involving 4 languages:

  • HTML: the visual and some constraints (range/required/...)
  • CSS: to make nicer forms
  • JavaScript: to validate forms/advanced constraints
  • PHP: to validate and process forms

The languages involved may change, but there is always a validation that should be done server-side πŸ“Œ, such as in PHP, as client-side validations can be bypassed, and they are only used to provide a better experience for normal users.