her03
her03

Reputation: 152

Post array limit?

I have problem when post many row data in my tabular input, i only see 500 rows.

here my code for detail:

<?php
if($_POST){
echo '<pre>';
print_r($_POST);
echo '</pre>';
}
?>

<form method="post" enctype="multipart/form-data" >
    <table>
        <tr>
            <td>Value</td>
            <td>Name</td>
        </tr>
    <?php for($i=1;$i<=1000;$i++){?>
        <tr>
            <td><input type="input" name="attributes[<?= $i ?>][value]" value="<?= $i ?>" /></td>
            <td><input type="input" name="attributes[<?= $i ?>][name]" value="<?= 'name'. $i ?>" /></td>
        </tr>
    <?php } ?>

    </table>
<input type="submit"/>
</form>

Upvotes: 10

Views: 9346

Answers (4)

Ketan Flitzen
Ketan Flitzen

Reputation: 11

Limit can be identified using max_input_vars which is default 1000.

If you have multiple arrays with unknown indexes, then you must need to change max_input_vars in php.ini file.

Upvotes: 1

Rutunj sheladiya tells you all about max_input_vars limit, which is your main question.

My solution was to json_encode the array so you only send a encoded string. Then in the destination server you must json_decode the array.

I think it's a clean solution since it can be a huge array and you couldn't know its size.

Now this only may be limited with the max_post_size if the json encoded string's size is higher than the value you have configured.

Greetings.

Upvotes: 3

Ivin Raj
Ivin Raj

Reputation: 3429

Try changing max_input_vars as well. More information: PHP max_input_vars and big forms.

Upvotes: 1

Rutunj sheladiya
Rutunj sheladiya

Reputation: 646

PHP introduced the max_input_vars config option, which is defaulted to a value of 1000. Check out the Runtime Configuration section of the PHP manual.

The value can be changed by updating the server's php.ini, adding an .htaccess file, or adding a line to httpd.conf.

Upvotes: 17

Related Questions