input submit tag

<input type=”submit” name=”submit” value=”submit”>

There are so many submit in the input tag, what do they mean?

We often use <input> in a form to transfer back some user input values, such as this one:

<input type="text" name="address">

This <input> displays a edit box on the webpage. You can input some text in the box and click a submit button to transfer the text to the server side. So the complete html form is like this:

<form action="/handler.php" method="post">
  <input type="text" name="address">
  <input type="submit">

If we omit the name property for the the <input> tag, the user input text won’t be transferred back to the server after clicking the submit button. If we have a name for the input, but user does not input anything in the edit box, the empty value is still transferred back the server after submission, i.e., the $_POST array contains the address variable although its value is empty.

The <input> tag of type submit is used to trigger the data transfer to the server. So normally, there is no variable in $_POST that is related to the submit <input>.

But you can assign name and value properties to the submit input as text input like:

<input type="submit" name="submit" value="submit">

Now, after clicking the submit button(the submit input), the server will get a variable named “submit”(specified by the name property of the input tag) whose value is submit(specified by the value property of the input tag). But submit input has a little difference from the text input. If you do not provide the value property, it will transfer the default value “Submit Query” to the server. If you provide the value property, it is also displayed on the submit button.

If you like my content, please consider buying me a coffee. Buy me a coffeeBuy me a coffee Thank you for your support!

Leave a Reply