How about you read a tutorial on HTML forms?
The data entered in the form must be send to a server. The action
attribute tells the browser which server.
Also, there are two common ways to send the data: through POST
(in the HTTP
header) and through GET
(as part of the query string, the part after the question mark in a URL
). Which method must be used is specified in the method
attribute.
POST
is commonly used when data should be submitted only once or should be private (e.g. registering at or logging in to a site). GET
is used for data that may be send as often as necessary (because the resulting URL
contains a query string that one can e.g. bookmark). Example: Google search queries are sent using GET
, but to log in to your GMail account POST
is used. A more elaborate explanation can be found here.
Edit: below you ask why the whole page can't just be wrapped in one form tag. As divo correctly answers: you may have multiple forms that can be submitted to different servers. For example, you can provide two text fields on your webpage: one that allows one to search the site using Google, the other using Yahoo. With a little creativity other uses will come to mind.
Edit 2:
Can you point to a different tutorial?
W3Schools has errors. – David Dorward
10 mins ago
If that is so (I didn't check), these two look promising: