PHP - Message is lost after 70th variable in array

Ok, I took the time to try and figure this out. I have a while loop that takes lines from the database and echos the input for each s selected_id[]

for names. When submitting, I use $ _REQUEST to collect the selected checkboxes, but for some reason, none of the inputs after the 70th variable will be posted. selected_id[0]

through selected_id[70]

will be published as normal, but selected_id[71]

above will not be.

Why can I only $ _REQUEST array up to the 70th variable in this array?

If I delete one of the records from the database, the problem still occurs when the 71st position is called again, or selected_id[70]

I am using PHP version 5.3.15 and my max_input_vars is 1000. my max_input_nesting_level is set to 64, but I don't think this is causing the problem. My memory_limit is set to 20M.

Here is 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 awful english ... I really appreciate any help you can give, thanks in advance.

+3


source to share


2 answers


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

php_value post_max_size 15M

      



Fix code: (You miss the 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>

      

+1


source


Basically your post length is longer than PHP.

If you are using shared hosting you can use .htaccess like:

#set max post size
php_value post_max_size 20M

      



Otherwise, edit php.ini if ​​you have your own server ...

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

0


source







All Articles