T
Tom Asken
Short version: IE 6.0 wrongly posts <button ..> value. Internet
Explorer should only post the value of the clicked submit button - but
IE 6 posts the value of several submit buttons if they have the same
name
Long version:
I have a form with several Buttons with the same name and different
values. According to the w3c only successful controls supposed to be
submitted:
"A successful control is "valid" for submission. Every successful
control has its control name paired with its current value as part of
the submitted form data set. A successful control must be defined
within a FORM element and must have a control name. ..."
And
"If a form contains more than one submit button, only the activated
submit button is successful."
see at http://www.w3.org/TR/html401/interact/forms.html#successful-controls
So they speak of "submit button". The tag "<input type='submit'
name='myButt' ...>" supposed to be the same as "<button type='submit'
name="myButt' ..>foo</button>" accept for richer layout:
So i assume that only the clicked <button> supposed to be posted. Well
mozilla 1.7 does it right. IE 6 makes it wrong.
It is getting really annoying with this old (2001 ?!) Internet
Explorer 6.0
Here is an exmaple:
-------------------------------------------------------------------
<FORM action="" method="post">
<button type="submit" name="IEmyButt"
value="A is firstButton">A</button>
<button type="submit" name="IEmyButt"
value="B is secondButton">B</button>
</FORM>
-------------------------------------------------------------------
PHP show post values
<?
//php
echo "<span style='color:red'>Post<pre>"; print_r($_POST); echo
"</pre></span>";
?>
-------------------------------------------------------------------
Thanks.
Best Regards
Explorer should only post the value of the clicked submit button - but
IE 6 posts the value of several submit buttons if they have the same
name
Long version:
I have a form with several Buttons with the same name and different
values. According to the w3c only successful controls supposed to be
submitted:
"A successful control is "valid" for submission. Every successful
control has its control name paired with its current value as part of
the submitted form data set. A successful control must be defined
within a FORM element and must have a control name. ..."
And
"If a form contains more than one submit button, only the activated
submit button is successful."
see at http://www.w3.org/TR/html401/interact/forms.html#successful-controls
So they speak of "submit button". The tag "<input type='submit'
name='myButt' ...>" supposed to be the same as "<button type='submit'
name="myButt' ..>foo</button>" accept for richer layout:
So i assume that only the clicked <button> supposed to be posted. Well
mozilla 1.7 does it right. IE 6 makes it wrong.
It is getting really annoying with this old (2001 ?!) Internet
Explorer 6.0
Here is an exmaple:
-------------------------------------------------------------------
<FORM action="" method="post">
<button type="submit" name="IEmyButt"
value="A is firstButton">A</button>
<button type="submit" name="IEmyButt"
value="B is secondButton">B</button>
</FORM>
-------------------------------------------------------------------
PHP show post values
<?
//php
echo "<span style='color:red'>Post<pre>"; print_r($_POST); echo
"</pre></span>";
?>
-------------------------------------------------------------------
Thanks.
Best Regards