Content · Web Development · HTML

HTML Repeated Field Groups and Name Conventions

Repeated Field Groups and Name Conventions: Each guest gets a distinct ID and label. Bracket-style name conventions are server-specific and should match the backend parser. Includes a practical HTML example and an explanation.

1 views Published Oct 19, 2026 Updated Oct 19, 2026 Admin

A form should feel easy to use. The visitor sees a question, gives an answer, and needs to know what will happen next.

What You Need to Know


Each guest gets a distinct ID and label. Bracket-style name conventions are server-specific and should match the backend parser.

Try the Example


Take a look at the example. We’ll explain the important lines right below it.

<form action="/guests" method="post">
    <fieldset>
        <legend>Guest one</legend>
        <label for="guest-1-name">Name</label>
        <input id="guest-1-name" name="guests[0][name]">
    </fieldset>
    <fieldset>
        <legend>Guest two</legend>
        <label for="guest-2-name">Name</label>
        <input id="guest-2-name" name="guests[1][name]">
    </fieldset>
    <button type="submit">Continue</button>
</form>

Let’s Read the Code


  • name: The name is the key used for the submitted value.
  • <form>: The form groups controls and identifies where submitted data goes.
  • <fieldset>: The fieldset keeps related choices together.
  • for: For connects a label or output with a control by ID.

Read the named elements and attributes together. They explain how the browser connects this feature to the rest of the page.

What Happens in the Browser?


The HTML controls work in the browser, but saving an answer requires the example action path to be handled by a real server.

Where does the answer go? The example uses the submitted name(s) guests[0][name], guests[1][name]. Those names help the receiving server identify each answer. A label is for people; a name attribute is for the form data; an ID connects elements in the page.

Your Turn


Add a third guest and update both ID and name attributes consistently.

Common Beginner Mistakes


  • Copying the example without giving the fields a clear label and a usable name.
  • Do not reuse the same ID on repeated fields.

Key Takeaways


  • With repeated Field Groups and Name Conventions, the main idea is to match the HTML to the visitor’s task, not just to copy an unfamiliar attribute.
  • name: The name is the key used for the submitted value.
  • Remember that HTML form rules help the visitor, but server-side code must decide whether received data is valid.
Share this resourceSend this page to someone who may find it useful.