Single logo
  • Courses
  • Blog
  • About
Join on SkoolJoin on Skool

In this topic

React
  • One Request, Two Answers: the Same Post as an HTML Page and as JSON
  • A Blog Design from a Prompt: Downloading Figma Make Code and Reading App.tsx and BlogCard.tsx
  • How a Web Page Works: HTML Tags, Elements and Attributes
  • Semantic HTML: header, nav, main, aside and footer as Page Landmarks
  • HTML Forms: Labels, Names, Input Types and Where the Data Goes (GET vs POST)
  • CSS Basics: Selectors, Which Rule Wins, and the Box Model
  • CSS Flexbox vs Grid: A Nav Bar, a Card Row and a Dashboard
  • Responsive CSS: Viewport, Mobile-First Media Queries, clamp() and Dark Mode with Tokens
  • JavaScript for People Who Already Code: Syntax, Modules and Five Surprises
  • JavaScript Arrays the Functional Way: map, filter, reduce, find, sort and Object.entries
  • Async JavaScript: Promises, async/await, fetch and Promise.all
  • JavaScript in the Page: the DOM, querySelector and Events
  • npm, package.json and Vite: What npm install Fetches and How Vite Serves and Builds Your Page
  • TypeScript Essentials: Types Checked, Then Erased (Interfaces, Unions, Generics)
  • Why React, JSX and Components: The Page as a Function of Data
  • React Props and Composition: Data Down, Calls Up, Children in the Slot
  • Routing With React Router: One Page, Many Addresses
  • React Component Tests With Vitest and Testing Library: Test What the User Sees
  • End-to-End Tests for a React App With Playwright: A Full Dress Rehearsal
  • Why AI-Built Websites All Look the Same, and Four Levels That Fix It
  • Visual Hierarchy, Spacing and the 8-Point Grid: Tell the Eye What to Read First
  • Colour, Contrast and Dark Palettes: 60-30-10, Semantic Tokens and Ratios You Can Compute
  • Typography That Sells: Type Scale, Line Length and Free Font Pairings
  • The UI Element Catalogue: Buttons to Toasts, Their Jobs, States and shadcn/ui Names
  • Design Tokens: Primitive and Semantic Tokens, from Figma to CSS to Tailwind
  • Tailwind CSS 4 in React: Utility Classes, Responsive Prefixes, Hover and Dark Mode
  • shadcn/ui in React: Components You Own, Edit and Commit
  • Design Tokens to a Tailwind Theme: Light and Dark Mode with @theme inline
  • Motion in React: Entrance, Hover, Exit and Layout Animations
  • A React Dashboard: Stat Cards, a Recharts Line Chart and a Sortable Table
  • Accessibility in Practice: Dialogs, Menus and the Keyboard in React
  • Reference-Driven Design: Extract a DESIGN.md From a Site You Admire and Build From It
  • Components, Variants and Variables: One Design System in Figma and in CSS
  • Figma MCP Server: Build a React Component From a Frame, Then Write It Back
  • Claude Design: From a Brief to a Clickable Prototype, Then Hand It Off to Claude Code
  • Critiquing AI-Generated UI: Six Checks for Every Screen
  • The AI Design Landscape: Prompt to UI, Prompt to App, and Design to Code
  • Your Brand Rules Folder: One Folder Every AI-Built Page Follows
  • The Best-Practice UI Prompt: Plain Sentences That Beat the Average AI Page
  • UI Ideas From Figma Make, Google Stitch and ChatGPT: One Prompt, Three Designs
  • Google Stitch From a Sketch or Screenshot: Show the Layout, Say What to Keep
  • Stitch to Figma to Code: Turn a Stitch Screen Into Code That Uses Your Tokens
  • Figma Make: Prompt to Prototype With a Four-Part Prompt
  • Upgrade a Dated UI From One Screenshot (or a Reference Image)
  • States and Feedback: Make Every Click Get an Answer
  • A Design-Loop Skill: Claude Screenshots, Scores and Fixes Its Own UI
  • Copy Without the AI Tells: A Copy Pass on a Landing Page
  • React State, Events, Lists and Conditional Rendering: Follow One Click
  • React useEffect: When It Runs, What Cleanup Is For, and When You Don't Need One
  • Lifting State Up, Refs and React DevTools: Put State Where It Is Needed
  • Forms and Actions in React 19: Controlled Inputs, Form Actions, useActionState and useFormStatus
  • React Context and Custom Hooks: Share One Value, Reuse the Logic
  • Server State With TanStack Query: One Key, One Request, One Cache
  • Mutations and Optimistic Updates in TanStack Query: Change Data, Then Tell the Cache
  • Generate TypeScript Types, Query Hooks and Zod From an OpenAPI Spec With Orval
  • A Mock Backend in the Browser With Mock Service Worker, Generated From the Spec
  • A React Client for a FastAPI API: The CORS Wall, CORSMiddleware and the Vite Proxy
  • Forms With React Hook Form and Zod: The API's Rules in the Browser, the Server's Errors Under the Field
  • JWT Auth in a React Client With a FastAPI Backend: Log In, Carry the Token, Let the Server Decide
  1. Blog
  2. /
  3. React
  4. /
  5. Fundamentals

HTML Forms: Labels, Names, Input Types and Where the Data Goes (GET vs POST)

Follow a sign-up form's answers out of the page: label and id, name as the key, browser validation, the query string a GET form builds, and why POST hides it. Plus the most common bug, an input with no name.

Chaand Sheikh

·27 November 2026·Updated 28 November 2026Fundamentals

What you will learn

  • Connect a label to its input with for and id
  • Explain why every input needs a name, and read the query string a GET form sends
  • Use required, type=email, number with min and max, select and textarea for browser checks
  • Choose between method get and method post

Before you start

  • HTML tags, elements and attributes

Picture a paper form at a counter, a course sign-up. The printed question, "Full name", is the label. The box you write in is the input. Every box also has a small box number, and the clerk types your answer under that number; in HTML that is the box's name. And the counter you hand the form to is the action, the page that receives the answers.

Keep those four words in mind and forms stop being mysterious.

Your first form

  <h1>Course sign-up</h1>
  <!-- action: the page that gets the answers -->
  <!-- method="get": they travel in the address bar -->
  <form action="thanks.html" method="get">
    <!-- for matches id: this label belongs to this box -->
    <p><label for="name">Full name</label>
      <input id="name" name="name"></p>
    <!-- name is the key that is sent: email=... -->
    <p><label for="email">Email</label>
      <input id="email" name="email"></p>
    <button>Sign up</button>
  </form>

Three attributes do the work here:

  • for="name" on the label matches id="name" on the input, so this label belongs to this box. Clicking the label puts the cursor in the box.
  • name="email" is the key the answer is sent under, like the box number on the paper form.
  • action="thanks.html" is the page that gets the answers, and method="get" says how they travel. Leave out the action and the answers go back to the same page.

Where the answers go

Emma fills in the form: Full name, Emma Clarke; Email, [email protected]. She presses Sign up. The browser pairs each box's name with what was typed and opens thanks.html with the pairs stuck on the address:

thanks.html?name=Emma+Clarke&email=emma%40example.com
Two inputs named name and email become two pairs, joined after a question mark with an ampersand; plus is a space and percent 40 is the at sign. name = "Emma Clarke" email = "[email protected]" thanks.html?name=Emma+Clarke&email=emma%40example.com ? starts the answers & goes between pairs + is a space %40 is the @ sign method="get": the answers ride in the address bar
Each input's name becomes a key, and what was typed becomes its value.

The question mark starts the answers, the & goes between pairs, a plus is a space, and %40 is the @ sign. Fill in a form, press the button, read the address bar: that's the fastest way to see what a form really sends.

Input types and rules

The full sign-up form uses the same idea with more boxes, and lets the browser check the answers:

  <form action="thanks.html" method="get">
    <!-- required: the form will not send while this is empty -->
    <p><label for="name">Full name</label>
      <input id="name" name="name" required></p>
    <!-- type="email": the browser checks for an @ -->
    <p><label for="email">Email</label>
      <input id="email" name="email" type="email" required></p>
    <!-- a number box: only 1 to 4 seats -->
    <p><label for="seats">Seats</label>
      <input id="seats" name="seats" type="number" min="1" max="4"></p>
    <!-- a drop-down list: value is what is sent -->
    <p><label for="course">Course</label>
      <select id="course" name="course">
        <option value="html">HTML and CSS</option>
        <option value="design">Web design</option>
      </select></p>
    <!-- a big box for longer text -->
    <p><label for="note">Note</label>
      <textarea id="note" name="note"></textarea></p>
    <button>Sign up</button>
  </form>
  • required means the form won't send while this box is empty.
  • type="email" makes the browser check for an @.
  • type="number" with min="1" and max="4" gives a number box that only accepts one to four seats.
  • select is a drop-down list. The chosen option's value is what's sent, so picking "HTML and CSS" sends course=html.
  • textarea is a big box for longer text.

The browser checks first

Press Sign up with bad answers and nothing is sent:

  • Everything empty: the browser jumps to Full name and says "Please fill out this field."
  • An email without the @: "Please include an '@' in the email address."
  • Nine seats: "Value must be less than or equal to 4."

When every answer is valid, the form is sent and the address bar ends in name, email, seats, course and note. None of this needs JavaScript. Browser checks are for the user's convenience, though. A server must still check everything it receives, because anyone can send a request without your form.

A postcard or a sealed envelope

There are two ways to send a form.

  • method="get" is a postcard. The answers are written on the outside, in the address bar, where anyone can read them (and where they end up in browser history).
  • method="post" is a sealed envelope. The same answers travel inside the request, and the address bar shows only the page.

Use GET for a search or a filter, where a shareable address is useful. Use POST for a sign-up, a password, or anything that changes something.

Same form, sealed envelope

The third example is the first form with one change:

  <!-- method="post": the answers go inside the request, -->
  <!-- not in the address bar. Only a server can read them. -->
  <form action="thanks.html" method="post">

Press Sign up and the address bar shows nothing after thanks.html. The answers aren't gone. When the form is sent to a server, DevTools, Network, Payload shows them: name Emma Clarke and email [email protected], the same pairs as before. The catch is that a plain HTML file can't open the envelope. Only a server can read a POST body, which is exactly what a backend such as FastAPI or Django is for.

Break it: a box with no name

This is the most common form bug. Delete name="email" from the email input. Emma types into both boxes, presses Sign up, and the address bar ends in only name=Emma+Clarke. The email is gone.

There's no error and no warning. The box fills in fine, but with no name there's no key, so the value is never sent. If a field "disappears" on the server, check its name first.

A form in four lines

AttributeJob
for on the label + id on the inputthe question and the box it belongs to
namethe key the answer is sent under; no name, not sent
type, required, min, maxwhat may go in; the browser checks before sending
action and methodwhere it goes: in the address bar with GET, inside the request with POST

Try it yourself

Add a City box with a label and a name to the sign-up form, press Sign up, and find city= in the address bar. Then change the method to post and watch it disappear. Later, JavaScript in the page takes over the same kind of form with a submit listener and preventDefault().

Tried the exercise? Share your answer or ask a question.

The StudyEasy AI Community is free to join, with the lesson files, notebooks and code.

Join free on Skool

Keep going in React · 5 of 59

Previous
Semantic HTML: header, nav, main, aside and footer as Page Landmarks
Next post
CSS Basics: Selectors, Which Rule Wins, and the Box Model

Related course on Udemy

The Python Architect Masterclass: Full Stack to AI Engineer

Python, Django, FastAPI, React, Docker, AWS, LLMs, RAG, agents and MCP, from first steps to AI engineer.View on Udemy ↗: The Python Architect Masterclass: Full Stack to AI Engineer (paid course, opens in a new tab)

Related posts

One Request, Two Answers: the Same Post as an HTML Page and as JSON

Ask a Django blog for the same post twice: once as a 12,731-byte HTML page built by a template, once as 2,976 bytes of JSON built by a serializer. Compare the headers, see who builds the page, and why the server still owns every write.

A Blog Design from a Prompt: Downloading Figma Make Code and Reading App.tsx and BlogCard.tsx

Make a blog design from a prompt in Figma Make, download src.zip, unzip it with Python's zipfile module, and read the two files that matter: App.tsx with its selectedPost state and BlogCard.tsx with its props.

How a Web Page Works: HTML Tags, Elements and Attributes

A web page is a text file full of labelled pieces. Learn tags, attributes and nesting with three tiny pages, and see what breaks when an attribute or a closing tag is wrong.

Semantic HTML: header, nav, main, aside and footer as Page Landmarks

The same page written as div soup and with semantic tags looks identical, but only one gives screen readers and search engines landmarks and an outline. Plus tables, div, span and the one-main rule.

On this page

  • Your first form
  • Where the answers go
  • Input types and rules
  • The browser checks first
  • A postcard or a sealed envelope
  • Same form, sealed envelope
  • Break it: a box with no name
  • A form in four lines
  • Try it yourself
Community · Free to join
Single logo

StudyEasy AI Community

Hosted onSkool

Learn AI engineering, share what you build, and connect with other learners.

  • Free resources: lesson files, notebooks and code

  • Ask questions and join engineering discussions

  • Meet real people learning and building with AI

Join free on Skool

Related course on Udemy

The Python Architect Masterclass: Full Stack to AI Engineer

Python, Django, FastAPI, React, Docker, AWS, LLMs, RAG, agents and MCP, from first steps to AI engineer.View on Udemy ↗: The Python Architect Masterclass: Full Stack to AI Engineer (paid course, opens in a new tab)

Single logo

Empowering Education, One Course at a Time

About
About usContact us
Legal
Terms of UsePrivacy Policy

© 2026 StudyEasy Organization. All rights reserved.