Skip to content
Related Articles

Related Articles

How to create a hidden input field in form using HTML ?

Improve Article
Save Article
  • Last Updated : 18 Oct, 2021
Improve Article
Save Article

In this article, we will learn how to add a hidden input field into our form using HTML. A hidden control stores the data that is not visible to the user. It is used to send some information to the server which is not edited by the user.  Normally, this hidden field usually contains the value which is common for all the users. The value must be recorded in the database. 

A hidden input field often contains those value which needs to be updated on the database when the form is submitted. 


  • We create an HTML Document that contains an <input> Tag.
  • Use the type attribute with the <input> tag.
  • Set the type attribute to value “hidden“.


<input type="hidden">  

Example: In this code, we create a hidden field that contains a record of the user who belongs to the same country i.e India. 


<!DOCTYPE html>
        How to create a hidden input 
          field in form using HTML?
        h1 {
        body {
        How to create a hidden input 
          field in form using HTML?
    <form action="#">
        <input type="hidden" name="country_name" 
            id="inputID" value="India" >
        Name: <input type="text">
        <input type="submit" value="Submit">


hidden input field

My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!