› Forums › Web Development › HarvardX: CS50W – CS50’s Web Programming with Python and JavaScript › CS50W – Lecture 0 – HTML and CSS › Q. Does a submit button end the form submission?
- This topic is empty.
-
AuthorPosts
-
December 30, 2025 at 10:07 am #5909
How Does a Submit Button Work in an HTML Form? (Q&A)
Answer:
A submit button does not “end” a form, but it triggers the form submission at that moment.When clicked, the browser immediately collects all the values the user has entered so far and sends them to the server.
Q2. What exactly happens when a submit button is clicked?
Answer:
When a submit button is clicked, the browser:- Collects all valid input fields inside the
<form> - Reads their
name = valuepairs - Identifies which submit button was clicked
- Sends the data to the URL specified in the form’s
action
Q3. Are all previously entered values submitted?
Answer:
Yes.
All values entered before clicking the submit button are included in the submission, provided the inputs:- Have a
nameattribute - Are not disabled
Q4. Does the submit button itself send any data?
Answer:
Only the clicked submit button sends data — and only if it has anameattribute.Example:
<input type="submit" name="btnI" value="I'm Feeling Lucky">This sends:
btnI=I'm+Feeling+LuckyOther submit buttons in the same form are ignored.
Q5. What input values are included in a form submission?
Answer:
Included:- Text inputs, textareas, selects (with
name) - Checked checkboxes and radio buttons
- Hidden inputs
- The clicked submit button (if named)
Not included:
- Inputs without a
name - Disabled inputs
- Placeholder text
- Unclicked submit buttons
Q6. Is placeholder text ever submitted?
Answer:
No.
Placeholder text is only a visual hint and is never treated as actual input data.
Q7. Can one form have multiple submit buttons?
Answer:
Yes.
A single form can have multiple submit buttons, each representing a different action.The server determines which action to perform based on which submit button was clicked.
Q8. Why do some submit buttons have a
nameattribute?Answer:
Thenameattribute allows the server to distinguish between different submit buttons.Without a
name, the server cannot tell which button triggered the submission.
Q9. What is the simplest way to remember how submit buttons work?
Answer:
Think of a form like an envelope:- The user fills it with information
- Clicking submit seals it
- The browser sends it to the destination
One-Line Takeaway
A submit button triggers the form submission and sends all user-entered values up to that point, along with information about which button was clicked.
- Collects all valid input fields inside the
-
AuthorPosts
- You must be logged in to reply to this topic.

