The HTML tags that create the crawl form
In this article, I will introduce some HTML tags used to create the most commonly used data entry form. These tags I have introduced a lot in this HTML and CSS learning category.
Before you start, you must understand what is the concept of form data? Why do we need to use forms and when should we use them? What input tags should be used during form creation? Come on, let's get started.
1. What is form data?
Website is considered as a software to help connect with all users in the world. All the data that you see on the website is sent from a real IP address that exists on the internet.
When you visit a website, it means that you have sent a request for the corresponding IP address for that domain ( we call it the server ). The server will return you a set of data in HTML format. And the question is what if the server side needs to get your information? Very simply, HTML provides us with a number of tags that help the server get data from the user, which are the tags of the form group.
So, form data is a form consisting of a set of HTML codes belonging to the form group such as: Contact form, comment form, order form … It uses tags like: input, select, option, textarea, button to allows users to enter data and send it to the server.
2. Most commonly used form-forming HTML tags
Now I will introduce the tags first, then we will make a form in the 3rd part.
Use the form tag to surround the forms
All forms must begin with a form tag, which surrounds all other tags. It has two important properties:
action . Although you are doing the interface, you should also follow this rule. As for its use, we will find out later.
<form method="post" action="url"> </form>
Use the input tag to create an input box
The input tag is used most often. It comes in various formats such as:
- A data entry box
- Radio boxes
To specify the type, we use the type attribute. See the example below for better understanding.
<form method="post" action="url"> Input: <input type="text" value=""/> <br/> Radio: <input type="radio" value=""/> <br/> Checkbox: <input type="checkbox" value=""/> </form>
Use textarea tag to get big data
The textarea tag works like the
input type=text tag. However, in terms of display, it will be wider, and instead of data displayed on one row, it will display on many rows.
<form method="post" action="url"> <textarea cols="20" rows="10"></textarea> </form>
Use input tag to create submit button
The submit button is very important, it helps the browser know when to start sending data to the server. To create a submit button, we use the input tag as follows.
<form method="post" action="url"> <input type="submit" value="Liên hệ"/> </form>
Use the select tag to create a combobox
This is the final format in this lesson. To create a drop-down list of options, use the select tag.
<form method="post" action="url"> <select> <option> -- Hãy chọn -- </option> <option>Tùy chọn 1</option> <option>Tùy chọn 2</option> <option>Tùy chọn 3</option> <option>Tùy chọn 4</option> </select> </form>
Above is a collection of all the most commonly used HTML tags. Now let's do a little exercise together.