Question

I am using FormHelper in CakePHP 2.1.2. When I post a form with many element groupings the resulting $request->data array truncates on the 143rd group. For example:

<?php
// going through a large for() loop using iterator $iter.

echo $this->Form->hidden('field1', array('name' => "Example[$iter][field1]", 'value' => 'field1'));
echo $this->Form->hidden('field2', array('name' => "Example[$iter][field2]", 'value' => 'field2'));
echo $this->Form->hidden('field3', array('name' => "Example[$iter][field3]", 'value' => 'field3'));
echo $this->Form->text('text', array('name' => "Example[$iter][text]", 'value' => ''));
?>

The debug() result looks something like this:

array(
    (int) 0 => array(
        'field1' => 'field1',
        'field2' => 'field2',
        'field3' => 'field3',
        'text' => 'something',
    ),
    (int) 1 => array(
        'field1' => 'field1',
        'field2' => 'field2',
        'field3' => 'field3',
        'text' => 'something else',
    ),
    ....
    (int) 142 => array(
        'field1' => 'field1',
        'field2' => 'field2',
    ),
);

In $this->request->data['Example"], group 143 is broken. I have no clue as to how this is happening. Any ideas would be extremely helpful. Thanks a lot.

Was it helpful?

Solution

You probably need to crank up the value for max_input_vars in your php.ini

OTHER TIPS

A couple suggestions:

  • Use a browser extension like Live HTTP Headers to verify that all your fields are included in the post
  • Check your php.ini and/or .htaccess and make sure the post_max_size is not set to a very small value
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top