Input Submit | Sololearn: Learn to code for FREE!


Input Submit

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

7/1/2018 11:37:20 PM


3 Answers

New Answer


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


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"; }


Thank you all for your answers.