<form> element is used to collect and send information to an external source.
<form> can contain various input elements. When a user submits the form, information in these input elements is passed to the source which is named in the
action attribute of the form.
<form method="post" action="http://server1">Enter your name:<input type="text" name="fname" /><br />Enter your age:<input type="text" name="age" /><br /><input type="submit" value="Submit" /></form>
Submitting a Form
Once we have collected information in a form we can send that information somewhere else by using the
actionattribute tells the form to send the information. A URL is assigned that determines the recipient of the information.
methodattribute tells the form what to do with that information once it’s sent. An HTTP verb is assigned to the
methodattribute that determines the action to be performed.
<form action="/index3.html" method="PUT"></form>
In HTML, input fields have an attribute called
required which specifies that the field must include a value.
The example code block shows an input field that is required. The attribute can be written as
required="true" or simply
<input type="password" name="password" required />