In this article, we will learn about forms. Form in HTML is used to collect data from the user and later store it on the databases.
<form> tag is used to create a form in HTML.
In HTML forms, there are different types of input elements like text areas, buttons, radio buttons, checkboxes, and many more.
Let’s take an example of a basic form in which we will take the name of the user as input and a simple submit button.
<!DOCTYPE html> <html> <body> <h2>HTML Forms</h2> <form action="#"> Name:<input type="text"><br><br> <input type="submit" value="Submit"> </form> </body> </html>
The action attribute in forms is used to determine where to direct the form after it is submitted by the user. In this case, we have used ‘#’ because we don’t have to store the user’s data anywhere for now as it’s just a basic form with only a name, and the <br> tag in this is used for a line break.
Hope this article will guide you to recognize the basics of the HTML forms that you needed and in the next article, we will learn about some more input types. Still, if you have any problems or queries regarding this, please post them in the comments section and we will be glad to assist you.