HTML forms for Beginners
HTML forms are a fundamental part of web development, allowing users to input data and interact with a website. For any website or web application one of the most important task to take input from the user or collect data from the users.Â
An HTML Form help to take input ( data ) from the users and generally send to the server or the processing.
You can see login form, registration form , contact form and many other types of forms in a website which interact with user to take inputs.
Â
- action: Specifies the URL where the form data should be sent when the user submits the form.
- Method:Â Specifies the HTTP method to be used when sending the form data. Common methods are “GET” and “POST“.
Form elements
HTML <form> element uses different element to create a complete form to take input from the users – <input>, <select>,<button>, <label> and <textarea> etc.
Lets understand all of these-
<label>: It defines label for <form> elements which used to display text for other input element or simple text.
<input>: It is used to get input data from the form in various types such as text, password, email, etc
<button>: It defines a clickable button to control other elements or execute a functionality.
<select>: It is used to create a drop-down list.
<textarea>: It is used to get input long text content.
<fieldset>: It is used to draw a box around other form elements and group the related data.
<legend>: It defines a caption for fieldset elements.
<datalist>: It is used to specify pre-defined list options for input controls.
<output>: It displays the output of performed calculations.
<option>: It is used to define options in a drop-down list.
<optgroup>: It is used to define group-related options in a drop-down list.
Input Elements:
Input elements are used to collect various types of user input. Here are some common input types:
Â
Recent Post
Var keyword in C#
- May 8, 2024
- 4 min read
What is Cloud Computing ? Definition &
- April 2, 2024
- 4 min read
Devika – An Open-Source AI Software Engineer
- March 27, 2024
- 3 min read