FORM和POST数组中的复选框的顺序是否相同? [英] Are the order of Checkboxes in the FORM and the POST array the same?
问题描述
我有几个复选框,我想采取一种懒惰的方法将它们插入数据库。
I have several checkboxes and I am trying to take a lazy approach of inserting them into the DB.
所以我想知道,复选框的顺序
So I wanted to know, would the order of the checkbox array (checkboxes[]) in the POST super array be in the order that they are in my html page?
如果没有,那么我将不再是一个懒惰的开发者
If not, then I will just stop being a lazy developer!
感谢您的帮助。
推荐答案
a href =http://www.w3.org/TR/html4/interact/forms.html#h-17.13.4 =nofollow noreferrer> 17.13.4 HTML 4规范的表单内容类型< a>。对于应用程序/ x-www-form-urlencoded < a>:
Yes, see 17.13.4 Form content types of the HTML 4 specification. For application/x-www-form-urlencoded:
控件名称/值按文档中显示的顺序列出。该名称与
=
的值分隔开,并且名称/值对通过&
彼此分隔。 / p>
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&
.
零件被发送到处理代理以相同的顺序在文档流中出现相应的控件。
The parts are sent to the processing agent in the same order the corresponding controls appear in the document stream.
PHP手册的状态相同(参见 如何在HTML中创建数组< form>
? ):
The PHP manual states the same (see How do I create arrays in a HTML <form>
?):
指定数组键在HTML中可选。如果不指定键,数组将按照元素在表单中显示的顺序填充。
Specifying an arrays key is optional in HTML. If you do not specify the keys, the array gets filled in the order the elements appear in the form.
这篇关于FORM和POST数组中的复选框的顺序是否相同?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!