0

just a short overview what i want to do:

I have a "Gridview" containing cargodata from a mysql-db. The Grid contains a checkbox with the cargoid as value for each single row. Now the user have the option to select multiple cargo-elements and generate a pdf with the collis and some other informations.

Here's a snippet of the grid how it is built via php:

<table>
<tr id="first"></tr>
        <?php

        $collection = $_barcode->getBarcodeCollection($_SESSION['sort'], $_SESSION['order']);

        foreach ($collection as $row) 
        {               
            echo "<tr class='datarow'>";
            echo "<td><input type='checkbox' name='select[]' value='".$row['id']."' /></td>";
            echo "<td onclick=''>".$row['sku']."</td>";
            echo "<td>".$row['colli_']."/".$row['colli']."</td>";
            echo "<td>".$_man->getManufacturerById($row['manufacturer'])."</td>";
            echo "<td>".$row['barcode']."</td>";
            echo "</tr>";
        }
        ?>
</table>

This works fine so far if i select only a few entries. My database table now has ~ 4.000 Entries, so when i select all elements in the grid it only can pass 1.000 elements to the $_POST-Array, because php has set the max_input_vars to 1.000 by default.

And here is the part, where i get and process the values from the checked checkboxes:

if ($_POST['formaction'] == "generateBarcodes") 
{
        $barcodedata = $_POST["select"];
        $_ev = new Eventmgr();
        if($barcodedata!=null)
        {
            $barcodeitems = array();
            $data = array();

            // get all selected barcodes
            foreach ($barcodedata as $item)
            {
                $barcodeitems[] = $_barcode->getBarcodeById($item);
            }

            // Create an array which holds all data seperated by manufacturer
            foreach($barcodeitems as $i)
            {
                $data[$i["manufacturer"]][] = $i;
            }

            $_ev->logEvent("Begin with generating process....",1);
            $pdfgen = new generatepdf($data);
            $pdfgen->generatePDF();
        }
        else
        {
            $_ev->logEvent("Keine Barcodes ausgewählt!",2);
        }
}

So whats the problem now?

I've had set the max_input_vars to 6.000 and restartet the machine where my debian runs. But afterall it only selects ~900 selected checkboxes and ignores the other ~3.000 checkboxes even if they were selected.

So now im not sure what is going wrong there, i don't have the missing checkbox values inside the $_POST-Array before i process the data.

I hope someone can give me some hint or advice.

Thanks in advance and best regards tireniets

UPDATE #1 (23-12-2014): I've now tried the advices from the link provided by donald123 and also the hint Pankajkatiyar proviced.

Adding and setting the max_input_vars to the apache2 config didn't change anything, same result as i changed the post_max_size.

I have the bad feeling i'm overseeing something.

SOLUTION (23-12-2014):

Hey there guys,

I have to apologize....setting the max_input_vars inside the php.ini already works. The problem was, that i had overseen the semicolon before the line max_input_vars. My application now works as expected.

Best regards & happy holidays itreniets

itreniets
  • 27
  • 1
  • 8
  • What if you var_dump that `$_POST["select"]`? – vaso123 Dec 23 '14 at 12:17
  • maybe duplicatet content see http://stackoverflow.com/questions/9399315/how-to-increase-maximum-post-variable-in-php – donald123 Dec 23 '14 at 12:19
  • This link can help you for max_input_var [adding a line to httpd.conf](http://php.net/manual/en/configuration.changes.php) – Pankaj katiyar Dec 23 '14 at 12:36
  • @lolka_bolka: if i var_dump the $_POST["select"] i'm getting an array with only 989 items in it. Same result if i put it out with print_r. – itreniets Dec 23 '14 at 12:53
  • @donald123: Oh...i'm sorry, that post covers a part of my problem. I'll close my post after trying the options mentioned here and in the linked post. – itreniets Dec 23 '14 at 12:53

1 Answers1

0

i have to apologize....setting the max_input_vars inside the php.ini already works. The problem was, that i had overseen the semicolon before the line max_input_vars. My application now works as expected.

Best regards & happy holidays itreniets

itreniets
  • 27
  • 1
  • 8