HTML forms
Forms are an essential concept of html and are used in almost every application to get user input and feedback.
<form>…</form> tag is used to open up a html form.It has attributes like action=” “ and method=” “(GET and POST) to connect the form details to a backend server or database.
<label>…</label is used to describe what the input field is for.It has an attribute ‘for’ which is used to link the label with the corresponding input box.
<input/> is used to input the values to be submitted.attributes in <input> are ‘type’ which has many options — text,password,email,number,tel etc. Other attributes are ‘id’ which is used to link it to the label. ‘name’ is used to for form submission and database purpose. ‘value’ is used to put default value in place of input. ‘placeholder’ is used guide the user in form input.
Get Onkar Srivastava’s stories in your inbox
Join Medium for free to get updates from this writer.
radio and checkboxes are ‘type’ of input that require value attribute for database purpose. radios need same ‘name’ attribute so that only one choice is selected.
some ‘type’ has min and max for numerical values and step for periodic range.
<textarea>…</textarea> provides multiline input.
<select>…<option>…</option></select> provides a multiselect option to choose from. dropdown menus are available. ‘multiple’ is used to select multiple options.
<button>…</button> tag is used to submit the forms. It has types of submit and reset.
other attributes like ‘required’ , ‘disabled’, ‘read-only’ are also added to input in forms.







