简体   繁体   English

为什么我的字段在HTTP表单数据中时不在$ _POST中?

[英]Why is my field not in $_POST when it is in the HTTP Form Data?

I have an HTML form with method="POST" . 我有一个带有method="POST"的HTML表单。 There is a button with name="submit" in the form, plus a large number of hidden input fields with various names and values. 表单中有一个带有name="submit"的按钮,以及大量具有不同名称和值的隐藏输入字段。 I can see all the expected data coming through in the Request Header Form Data in my browser inspector. 我可以在浏览器检查器的“请求标头表单数据”中看到所有预期的数据。 However, the submit field is not present in $_POST in the php script that is the form's action target. 但是,作为表单action目标的php脚本中的$_POST中没有submit字段。

What am I doing wrong? 我究竟做错了什么?

Some extra tidbits: 一些额外的花絮:

  • Changing the name of the button doesn't help. 更改按钮名称无济于事。 The new name is still in the Form Data but not in $_POST 新名称仍在表单数据中,但不在$_POST
  • When I comment out all the hidden fields, it works fine 当我注释掉所有隐藏字段时,它可以正常工作
  • The HTML passes validation HTML通过验证
  • The button has a non-empty value 该按钮具有非空值

The problem was that I needed up bump up the max_input_vars value in my php.ini file. 问题是我需要提高php.ini文件中的max_input_vars值。 The number of hidden inputs was greater than max_input_vars and so $_POST was getting truncated, leaving off my submit input var. 隐藏输入的数量大于max_input_vars ,因此$_POST被截断,从而max_input_vars了我的submit输入var。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM