开发者

HTML Form submit buttons

开发者 https://www.devze.com 2022-12-27 14:47 出处:网络
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 p

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

精彩评论

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