Search code examples
cakephppostcakephp-2.1formhelper

Form data cut-off in CakePHP submission


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.


Solution

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