A form is used to collect some data from the user and in case of HTML form, the visitor fills the form for various purposes like to register on a website or do web search. As the web search done on www.google.com uses form elements to take input from the user of text to search and submit button to submit the query.
The most basic purpose of any form is to collect information. The form is collected and processed. Similarly with online forms are filled out, collected, and processed. As a paper form must be created, online forms need to be made with appropriate tags provided by HTML.
A form takes input from the site user or visitor and then will post to a back-end application in specific computer language like CGI, ASP or PHP etc. Then the back-end application will accomplish the required processing on that data as desired by user.