+ 2
Input Submit
In the input element, submit, why is it not necessary to have a name attribute?
3 ответов
+ 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/
+ 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"; }
+ 1
Thank you all for your answers.