Jeff Prachyl
Jeff Prachyl

Reputation: 277

PHP - Post getting lost after 70th variable in the array

Okay, I've spent way to long trying to figure this out. I have a while loop that takes rows from a database and echos an input for each one with selected_id[] for the names. On submit I use $_REQUEST to collect the selected checkboxes, but for some reason, none of the inputs after the 70th variable will post. selected_id[0] through selected_id[70] will post just like normal but selected_id[71] and higher will not.

Why am I only able to $_REQUEST an array up to the 70th variable in that array??

If I remove one of the entries from the database, then the problem will still occur at the 71st entry echoed or selected_id[70]

I'm using PHP Version 5.3.15 and my max_input_vars is set to 1000. my max_input_nesting_level is set to 64, but I don't believe that is whats causing the problem. My memory_limit is set to 20M.

Here is the majority my code:

<?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>

Sorry for my sloppy code and horrible English... I really appreciate any help you can give, thanks in advance.

Upvotes: 3

Views: 418

Answers (2)

One Man Crew
One Man Crew

Reputation: 9578

Set php_value post_max_size to be 15M(or more) in the php.ini:

php_value post_max_size 15M

Fix code:(You miss echo function)

<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>

Upvotes: 1

Brian
Brian

Reputation: 8616

Basically the length of you're post is larger than what PHP has been configured for.

If you're on shared hosting, you can use .htaccess, like so:

#set max post size
php_value post_max_size 20M

Otherwise, edit the php.ini if you have you're own server...

Size to use... up-to-you, 20M is a good size as a starter.

Upvotes: 0

Related Questions