Forms are the HTML mechanism for gathering input from the user.
To create a basic form, you need three elements: the form , input , and button elements.
<!DOCTYPE HTML> <html> <body> <form method="post" action="#"> <input name="name" /> <button>Submit> </form> </body> </html>
The form element, with local attributes: action, method, enctype, name, accept-charset,novalidate,target, autocomplete ,creates a form in an HTML page.
The novalidate and autocomplete attributes are new in HTML5.
The method attribute specifies which HTTP method will be used to send the form data to the server.
The allowed values are get and post , which correspond to the HTTP GET and POST methods.
The default value for method attribute is get .
<form method="post" action="http://example.com/form">
For GET requests, you can make the same request many times.
GET requests should be used for all read-only information retrieval.
POST requests are for unsafe interactions, where the act of submitting the data changes some kind of state.
POST requests should be used for any operation that changes the application state.