Submit button

Does submit button applies to whole form, or just to latest input element? For example:

<!DOCTYPE html>

First name:<input type="text" name ="firstname"><br>
Last name:<input type="text" name ="lastname"><br>
User name:<input type="text" name="username"><br>
Password:<input type="password" name="pwd"><br>
<input type="radio" name="sex" value="male">male<br>
<input type="radio" name="sex" value="female">female<br>
<input type="submit" value="Submit">


So, after pushing submit button, will whole form be passed to server or just the last input element before sumit input type?

What did your code show when you tried it?

Well, i think i miss something in form tag. It actually doesn’t work…

GENERALLY , a button (submit or otherwise) will send the entire form it’s in, the exception begin ,type=‘reset’.
For the submit action to take place , however, you also need the action (a URL) and the method (GET/POST) attributes in the FORM tag.

You could attach an event listener to the input (won’t work in javascript isn’t enabled) but usually the form tag has “action” and “method” attributes.