HTML Forms

HTML form on a web page allows a user to enter data that is sent to a server for processing. In another simple way, we can say that HTML Forms are required to collect different kinds of user inputs, such as contact details like name, email address, phone numbers, etc. Forms are enclosed in the HTML <form> tag. Forms mainly used two methods GET and POST to send data.

Forms contain special elements called controls like input box, checkboxes, radio-buttons, submit buttons, etc.





         <legend>Log In</legend>       

                <label>Username: <input type="text"></label>       

                <label>Password: <input type="password"></label>       

                 <input type="submit" value="Submit">   




HTML Forms Element

  • <Input> element





  • <select> and <option> element



  • <textarea> element



  • <button> element



 <!DOCTYPE html>

               <h2>The input Element</h2>

               <form action="/nk.php">
                 <input name="name" type="text">
                 <input type="submit">



<select name="cars"> 

              <option value="op1">mobile</option> 

              <option value="op2">laptop</option>


<textarea name="msg_box" rows="5" cols="15">

             Hi, codersarts 


<button type="button" onclick="alert('Hello')">Click here</button>

HTML5 Forms Element
  • <datalist>

  • <output>


In this tutorial we learn how to design form with the help of elements their are lots of elements in HTML forms so it is very important to learning purpose.

Powered  by Codersarts