开发者

HTML Form submit buttons

I know, this might be a very basic question but I am not 100% sure on the topic.

When submitting forms, is there a precise value that needs to be passed in order to inform that a certain button was pressed...

or can any value be passed in relation to the submit button's name?


Any ideas?


Edit:

Thank guys! I found out how 开发者_开发知识库to deal with the problem.

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

I just decided to check the data being posted on various forms and just decided to mimic them.

Everything works now, thanks for your help!


You could pass any value and you can check based on various possibilities whether form was submitted. For example, this is how we check in php whether or not form was submitted:

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

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


You should pass the <input type="submit">'s value attribute.

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

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

For more information, read the specification

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜