Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

arrays

post

php

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.

like image 698
Jeff Prachyl Avatar asked Jun 09 '26 01:06

Jeff Prachyl


1 Answers

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>
like image 126
One Man Crew Avatar answered Jun 11 '26 19:06

One Man Crew