3

好的,我花了很长时间试图弄清楚这一点。我有一个 while 循环,它从数据库中获取行,并为每个名称回显一个输入selected_id[]。在提交时,我使用 $_REQUEST 来收集选定的复选框,但由于某种原因,第 70 个变量之后的任何输入都不会发布。selected_id[0]throughselected_id[70]将像正常一样发布,但selected_id[71]更高版本不会。

为什么我只能 $_REQUEST 一个数组,直到该数组中的第 70 个变量?

如果我从数据库中删除其中一个条目,那么问题仍然会出现在第 71 个回显或selected_id[70]

我使用的是 PHP 版本 5.3.15,我的 max_input_vars 设置为 1000。我的 max_input_nesting_level 设置为 64,但我不认为这是导致问题的原因。我的 memory_limit 设置为 20M。

这是我的大部分代码:

<?php


   if(!empty($_REQUEST[assignedprocess])){

    $selected_id = $_REQUEST[selected_id];
    $howmany = count($selected_id);
    $msgback="(".$howmany.") Entry(ies) updated. <br>";
      echo $msgback; 
   }

?>

<form action="index.php" method="post" name="index">

    <?php

        while($row = mysql_fetch_array($result_groups)){

        echo "<input name="selected_id[]" type="checkbox" value="'.$row[id].'" />";

        }

    ?>
<input type="hidden" name="assignedprocess" value="11">
<input type="submit" name="subs" value="Apply">  
</form>

对不起我草率的代码和糟糕的英语......我非常感谢你能提供的任何帮助,在此先感谢。

4

2 回答 2

1

在 php.ini 中将 php_value post_max_size 设置为 15M(或更多):

php_value post_max_size 15M

修复代码:(你错过了回声功能)

<form action="index.php" method="post" name="index">

    <?php

        while($row = mysql_fetch_array($result_groups)){
          $id= $row[id];
          echo  "<input name='selected_id[]' type='checkbox' value= $id />";



        }

    ?>
<input type="hidden" name="assignedprocess" value="11">
<input type="submit" name="subs" value="Apply">  
</form>
于 2013-02-19T14:59:04.280 回答
0

基本上,您发布的长度大于 PHP 的配置长度。

如果您使用共享主机,则可以使用 .htaccess,如下所示:

#set max post size
php_value post_max_size 20M

否则,如果您有自己的服务器,请编辑 php.ini...

使用尺寸...由您决定,20M 是一个很好的尺寸作为首发。

于 2013-02-19T14:58:57.260 回答