HTML form submit buttons

I know this might be a very simple question, but I'm not 100% sure about this topic.

When submitting forms, there is an exact value that needs to be passed to indicate that a certain button has been pressed ...

or can some value be passed relative to the name of the submit button?


Any ideas?


Edit:

Thanks guys! I found out how to deal with this problem.

Since variables are passed to servers and are pretty much open to interpretation, depending on how they are read by the server,

I just decided to check the data posted on different forms and just decided to simulate it.

Everything is working now, thanks for your help!

+2


a source to share


2 answers


You must pass the attribute <input type="submit">

value

.

For example, if the user clicks the following submit button, the browser should submit GoNext=Next+Step



<input type="submit" name="GoNext" value="Next Step" />

      

For more information read the specification

+1


a source


You can pass any value, and you can check based on various possibilities if the form was submitted. For example, this is how we check php if a form has been submitted:



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

if (isset($_POST['submit']))
{
  // form was submitted !!
}

      

+2


a source







All Articles