1

I have Dynamic table having more than 1900 input box columns, I am unable to submit all fields through form submission, It only passes 60% rows to save page in php. I guess its Querystring Length Limitation.

I have added .htaccess file in website folder with following code:

RewriteEngine on

php_value post_max_size 512M

Even I have added php.ini file in public_html folder:

file_uploads = On

php_value post_max_size = 512M

upload_max_filesize = 512M

max_input_vars 2000

I have Godaddy's Shared Hosting Server. I have tried myself best, but form submits only 60% of fields. Even I have changed value of post_max_size value in php Selector option in C Panel.

mgutt
  • 5,867
  • 2
  • 50
  • 77
Nikhil
  • 27
  • 8

1 Answers1

0

If you are using GET you certainly run into the character limit of your browser.

Instead you should use the POST method in your form like

<form action="http://example.com" method="post">

Of course your max_input_vars should be more than your fields maximum amount. This setting limits the superglobals $_GET, $_POST and $_COOKIE separately.

If you are still using POST you should verify that your max_input_vars setting is active:

<?php
echo "max_input_vars: " . ini_get('max_input_vars') . PHP_EOL;
echo "post_max_size: " . ini_get('post_max_size') . PHP_EOL;
?>

You said you added php.ini to the public_html. Usually the php.ini is not located in this folder (maybe a special thing of your hoster?!). And it seems that your php.ini is not well formatted as you use the .htaccess keyword php_value and you forget to use an equal sign for max_input_vars.

If your php.ini does not work you should try to add all your settings to your .htaccess as follows:

php_value post_max_size 512M
php_value max_input_vars 2000

As @NigelRen suggested you can split the requests to reduce the total amount of fields as well. This could be solved by using AJAX. It allows sending requests to the server without reloading the page. A good JavaScript framework to realize this could be jQuery. By that you can update single fields after their focus is lost or you add a separate update button that sends only these rows to the server that have been changed (e.g. every input gets an ID and you count all of them that had focus). Using this method you can also limit the amount of fields that are sent to the server using a simple loop (e.g. only 100 fields are updated per loop).

An alternative method would be a pagination. This means you display only x rows per page, so the user is only able to update those x rows.

I suggest to use AJAX as it will reduce the performance requirements dramatically.

mgutt
  • 5,867
  • 2
  • 50
  • 77
  • Thank You Very Much Dear Sir, I have added php_value max_input_vars 10000 in php.ini file and also in .htaccess file, and finally it worked for me. I am very thankful to your best guidance. – Nikhil Sep 06 '19 at 07:09
  • @Nikhil Please accept my answer if it solved your question ;) – mgutt Sep 06 '19 at 07:10
  • sorry to ask, i am new to stackoverflow, where i can accept your answer? – Nikhil Sep 06 '19 at 07:13
  • Ok Sir, Thanks for everything. I have Accepted Your Answer. – Nikhil Sep 06 '19 at 07:21