Think of filling out a sign-up page. Clear fields make the job simple; confusing fields make people leave.
What You Need to Know
The pressed submit button contributes its name and value, letting the server distinguish Save from Send.
Try the Example
Take a look at the example. We’ll explain the important lines right below it.
<form action="/decision" method="post">
<label for="message">Message</label>
<textarea id="message" name="message"></textarea>
<button type="submit" name="choice" value="save">Save</button>
<button type="submit" name="choice" value="send">Send</button>
</form>
Let’s Read the Code
- value: The value is the actual data associated with a control or choice.
- name: The name is the key used for the submitted value.
- <form>: The form groups controls and identifies where submitted data goes.
- <label>: The label tells people what the input is for. A matching for/id pair makes the label clickable.
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.
What gets sent? With ordinary form submission, the browser builds a set of name/value entries. For checkboxes, only checked choices are normally included. Radio buttons in the same group contribute one selected value. Open the browser Network panel to see the request rather than guessing.
Your Turn
Inspect what choice is submitted after clicking each button.
Common Beginner Mistakes
- Copying the example without giving the fields a clear label and a usable name.
- Only the activated submitter is included; do not assume all buttons send their values.
Key Takeaways
- A control needs a clear label and, when submitted, a meaningful name and value.
- value: The value is the actual data associated with a control or choice.
- Remember that HTML form rules help the visitor, but server-side code must decide whether received data is valid.