HTML <input> name Attribute

Last Updated : 25 May, 2026

The HTML <input> name attribute specifies the name of an input field. It is used to identify form data when the form is submitted to the server.

  • Defines the name of the input field and helps identify form data.
  • Used for sending data as key-value pairs during form submission.
  • Required for accessing input values in server-side processing.

Syntax: 

<input name="name"> 

Attribute Values: It contains a single value name which describes the name of the <input> element. 

html
<!DOCTYPE html>
<html>

<head>
    <title>
        HTML Input name Attribute
    </title>
</head>

<body style="text-align:center;">

    <h1>GeeksForGeeks</h1>

    <h2>HTML Input name Attribute</h2>
    <form id="myGeeks">
        <input type="text"
               id="text_id" 
               name="geeks"
               pattern="[A-Za-z]{3}" 
               value="Ryan">
    </form>
    <br>
</body>

</html>
Comment