So I am on the lesson in which I have to make a submit button for a form…what I don’t get is why am I making a submit button nested inside a form element when I could just use the element with a submit attribute…wouldn’t this achieve the same with less work? Sorry if its a dumb question but i am reading on each lesson as I go in order to understand them through and through.
I think that is a rule because when you connect it with php for example you can have multiple forms in a single web, and the submit button sends the information that is only in his form field.
Hey, could you elaborate a bit more on that? I am fairly new to coding and I am not sure if you where talking about the submit button on the input element or the submit button on the form element.
Sorry i’m not an English speaker so it’s pretty difficult to me explain myself, but i’m gonna try.
When you click the submit button you send to the server information that it needs to do something…
But if the page has multiples forms how would your computer know what information to take and what to say to the server that he need to do?
For example, let’s assume you are working in a page that has 2 forms one for print some text on a imagen and one to generate a password with the words in the text (i have no imagination haha).
So the two informations that your computer sends are texts… If both have text, how would your computer know which one to send to the server and what to tell that he needs to do?
When you put the submit button inside a form you are telling to your computer, if the user clicks submit you should send only THIS information, and tell to the server to do THIS
Thanks, as additional information some explorers assume that if the form has only one button, then it assume that’s the submit button.
At leats according to the Mozilla reference. ( I didn’t know this, you learn something new all the days).