PHP表单POST中的复选框是否有限制? [英] Is there a limit on checked checkboxes in PHP form POST?
问题描述
我遇到了一个问题,似乎无法解决。我有一个表单(method = post enctype = multipart / form-data),用户可以在其中选择一些选项。他们
可以全部检查。如果他们全部选中,则表示他们正在检查
2000多个框。要检查我的表单是否实际发布,我有以下(不太复杂)代码:
I've come across a problem, which I can't seem to fix. I have a form (method="post" enctype="multipart/form-data") in which the user can choose some options. They have the possibility to 'check all'. If they 'check all', they are checking about 2000+ boxes. To check if my form actually gets posted, I have the following (not so complex) code:
<?php
if(isset($_POST['bijwerken'])) {
echo "YIPPEE!!";
}
?>
现在,如果我选中所有复选框,则不会得到任何反馈。如果我只选择20个框,我实际上会得到反馈。我想念什么?复选框也由脚本生成,并带有回显:
Now, if I check all the boxes, I don't get any feedback. If I only select like 20 boxes, I do actually get feedback. What am I missing? The checkboxes are also generated by a script, with an echo :
echo " <input type=\"checkbox\" name=\"productsoorten[]\" value='" . $rowproductsoorten1[productsoort1] . "'> " . $rowproductsoorten1[productsoort1] . "<br />";
希望听到一些好主意!
推荐答案
是的,实际上是 max_input_vars
设置。默认值为1000,如果输入字段的数量超过该数量,则您的帖子输入将不起作用。
Yes, there's actually a max_input_vars
setting. The default value is 1000 and your post inputs won't work if the number of input fields are more than that.
编辑您的 php.ini
文件(如果在Unix系统上,通常位于 /etc/php5/apache2/php.ini
)并增加限制:
Edit your php.ini
file (usually at /etc/php5/apache2/php.ini
if you're on a Unix system) and increase the limit:
max_input_vars = 5000
如果无法修改 php.ini
文件,则可以将其添加到 .htaccess
:
If you can't modify the php.ini
file, you can add this to .htaccess
:
php_value max_input_vars 5000
这篇关于PHP表单POST中的复选框是否有限制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!