Input Submit | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Input Submit

In the input element, submit, why is it not necessary to have a name attribute?

1st Jul 2018, 11:37 PM
arbaaz
3 Answers
+ 5
The button does have a similar attribute called “value”. The “value” name will change the text on the button. Here is the sytax for the input element submit: <input type="submit" value="Submit" /> Here is a leason on the form The last slide gives information on the submit element https://www.sololearn.com/learn/HTML/1035/
1st Jul 2018, 11:48 PM
Agent
Agent - avatar
+ 3
It's not necessary because its only job is to submit the form. But if you have multiple forms and a lot of input elements it's easier to check which form was submitted by checking which submit button value was set. And with a lot if inputs it's easier to avoid undefined index errors. if(isset($_POST["submit1"])){ echo "form 1 was submitted"; }
2nd Jul 2018, 12:31 AM
Toni Isotalo
Toni Isotalo - avatar
+ 1
Thank you all for your answers.
4th Jul 2018, 7:40 PM
arbaaz