Learn HTML by Building a Cat Photo App - Step 43

Tell us what’s happening:

I have no issue at all, But i have question regarding submit button. Why it need type=“submit” instead of name attribute?

still confused between those two attribute.

Your code so far


<!-- Below are the question -->

          <button>Submit</button>

<!-- Above are the question -->

   

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36

Challenge Information:

Learn HTML by Building a Cat Photo App - Step 43

1 Like

the name attribute is used on the side that receives the data in the form, it is used for elements where it is possible to input data.

The button can’t receive data from whoever is compiling the form, so it doesn’t need a name attribute. It needs a type attribute to establish its behaviour of submitting the form

ah i almost got it. so everytime someone type something and press enter. the backend will recieve the name attribute, rather than what the user input on the text attribute itself(?)

and about the button. if you dont put submit attribut. the form will not get submitted?

no, sending the data to the backend is submitting the form. attributes like name and value make sure that the data submitted is useful

exactly. You need a button or input dedicated to submitting the form, or it will not be submitted.

thanks for answering and about the
attributes like name and value make sure that the data submitted is useful

i hope on later chapter, i can understood about how name and value will useful. :grin:

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.