html – 浏览器在GET/POST上保持输入的相同名称的顺序吗?

我有这个HTML代码与多个输入具有相同的名称:

<input type="hidden" value="42" name="authors" />
<input type="hidden" value="13" name="authors" />
<input type="hidden" value="33" name="authors" />

值的顺序很重要。 HTML规范是否定义用户代理必须保留此顺序,如果是,常见(市场份额> 1%)浏览器是否遵循此定义?

奖金积分,如果有人知道WSGI,尤其是Django保留订单服务器端:-)

谢谢!

是的,他们应该按照他们出现的顺序发送,根据html rfc

见8.2.1。格式编码媒体类型:

The fields are listed in the order they appear in the document with the
name separated from the value by ='
and the pairs separated from each
other by
&’. Fields with null values
may be omitted. In particular,
unselected radio buttons and
checkboxes should not appear in the
encoded data, but hidden fields with
VALUE attributes present should.

我在html 4.0的规格也发现了:

对于网址编码数据:

The control names/values are listed in
the order they appear in the document.
The name is separated from the value
by =' and name/value pairs are
separated from each other by
&’.

对于多部分数据(感谢@Chuck):

A “multipart/form-data” message
contains a series of parts, each
representing a successful control. The
parts are sent to the processing agent
in the same order the corresponding
controls appear in the document
stream. Part boundaries should not
occur in any of the data; how this is
done lies outside the scope of this
specification.

翻译自:https://stackoverflow.com/questions/4027635/do-browsers-preserve-order-of-inputs-with-same-name-on-get-post

转载注明原文:html – 浏览器在GET/POST上保持输入的相同名称的顺序吗?