"disabled" _POST 变量表单元素在服务器端是否为空?

Are "disabled" _POST variable form elements empty Server-Side?

我有以下 <input> 表单元素:

<input id="serviceCode" name="serviceCode" type="text" placeholder="" class="form-control input-md" required="" maxlength="4" value="T2" disabled="">

这很奇怪,但这并没有作为 $_POST['serviceCode'] 变量返回到服务器。我是不是遗漏了什么或者 "disabled" 输入表单元素没有传回服务器?

禁用的元素不会发布到服务器 as per the spec :

... it cannot receive user input nor will its value be submitted with the form.

如果您想访问这些值,您可以考虑制作元素 readonly 或将值存储在隐藏元素中并使用另一个禁用元素来显示它。

对对对

提交表单时不发送禁用的表单元素。

http://www.w3.org/TR/html5/forms.html#attr-fe-disabled:

The disabled attribute is used to make the control non-interactive and to prevent its value from being submitted.” If you don’t want the user to be able to change the values, but still send them with the form when it is submitted – use the readonly attribute instead.