I’m using a form containing a button type shown below:
<form method="post" action="">
<button type=submit value="hello" name="submitform">World</button>
</form>
Here the button type shows different behavior on different browsers
now print_r($_POST) display
Array
(
[submitform] => World
)
In IE(v 7.0)
whereas
Array
(
[submitform] => Hello
)
in FF(v 3.5)
Why does it display different value…
now my questions are:
-
I want
[submitform]=Helloin both browser and I don’t want to change the value ‘World’ outside of<button> -
Is
<button type="submit">or<input type="submit">better
You could substitute the button’s information with a hidden input field:
This is a browserquirks save method.
Another possibility, although way less elegant, is to use an image:
Advantage: You can have multiple submit buttons submiting different values.
Disadvantage: As David Dorward mentioned, most probably you will face the same problem again because of buggy implementations, namely IE’s.
The third possibility is JavaScript, but you will encounter all sorts of problems for users having disabled it (I warned you!):