HTML Form – How to Insert Form in HTML with Example


In this tutorial you will know about HTML form. What is an HTML form , why it is used and what is a form consist of.

What is HTML form and Why it is used ?

An HTML form is same like a physical form that you may have used to get some data or send some data. Suppose you want to get admission in a college so you have to fill the admission form. Same as that when you need data of you visitors you will use HTML form also called online form. Use of HTML form is in website is very important even if you want to add a contact form you need an HTML form.

Syntax of Writing HTML Form


Form Elements here


An HTML form is start with opening a form tag ( <form> ) and ends with closing form tag ( </form> ). Inside this HTML form you will write other elements of form which you will learn in next tutorial.

Form Attributes

A form basically has two attributes. First is “ action “ and second is “ method “.

Action Attribute in HTML Form

Action attribute is used to send the data from HTML form to the database with the help of a web programming language such as PHP and Because this data has to be processed so you need this attribute in form tag. Suppose you want to verify a customer’s User Name and Password then you will send this form data to database which then will be verified.

Method Attribute in HTML Form

Method attribute tells which method will be used to send data to the database. There are two methods used to send data. First is “ GET “ and Second is “ POST “. In POST method the user will not see which data is being sent to database while in GET method user will know about the data being sent to database through the browser’s address bar. You will know more about this when you will study PHP and database.

See the basic HTML form Syntax with Attributes



Please enter your comment!
Please enter your name here