What's new

Pano to mafix

loktoy

Eternal Poster
Joined
Oct 20, 2014
Posts
1,168
Solutions
2
Reaction
103
Points
497
Age
30
Warning: Unknown: Input variables exceeded 1000. To increase the limit change max_input_vars in php.ini. in Unknown on line 0
ito code ko..

?php
if(isset($_POST['btnAdd'])){
$unique_payeename = array_unique($_POST['payeename']);
$unique_particular = array_unique($particular);
$unique_amount = array_unique($amount);
$unique_lddapada = array_unique($lddapada);
$unique_date = array_unique($date);
$unique_status = array_unique($status);
foreach($unique_payeename as $index => $value){
$new_payeename = $value;
$new_particular = $unique_particular[$index];
$new_amount = $unique_amount[$index];
$new_lddapada = $unique_lddapada[$index];
$new_date = $unique_date[$index];
$new_status = $unique_status[$index];
mysqli_query($con, "INSERT INTO lddap (payee_name, particular, amount, lddap_ada, date, status) VALUES ('$new_payeename', '$new_particular', '$new_amount', '$new_lddapada', '$new_date', '$new_status')");
echo "<script> window.location.href = voucher.php?notify=<font color=green>items uploaded</font>';</script>";
}
}
if(isset($_POST['btnUpload'])){
echo "<hr>";
echo "<table border='1' width='40%'>";
echo "<tr>
<td width='70%'><b>Payee Name</b></td>
<td width='70%'><b>Particular</b></td>
<td width='70%'><b>Amount</b></td>
<td width='70%'><b>LDDAP-ADA</b></td>
<td width='70%'><b>Date</b></td>
<td width='70%'><b>Status</b></td>
</tr>
<tr>
<td colspan='2'><hr></td>
</tr>

<form method = 'POST'>

";

$btnStatus = "ENABLED";
$filename = $_FILES['file']['tmp_name'];
if($_FILES['file']['size'] > 0) {

$file = fopen($filename, "r");

$row = 1;
$payeename = $particular = $amount = $lddapada = $date = $status = "";
$payeenameErr = $particularErr = $amountErr = $lddapadaErr = $dateErr = $statusErr = "";
while (($data = fgetcsv($file, 10000, ",")) !== false){

if($row == 1){
$row++;
continue;
}
if(empty($data[0])){
$payeenameErr = "Product name is empty";
$btnStatus = "DISABLED";
}else {
$payeename = $data[0];
}
if(empty($data[1])){
$particularErr = "Product name is empty";
$btnStatus = "DISABLED";
}else {
$particular = $data[1];
}
if(empty($data[2])){
$amountErr = "Product name is empty";
$btnStatus = "DISABLED";
}else {
$amount = $data[2];
}
if(empty($data[3])){
$lddapadaErr = "Product name is empty";
$btnStatus = "DISABLED";
}else {
$lddapada = $data[3];
}
if(empty($data[4])){
$dateErr = "Product name is empty";
$btnStatus = "DISABLED";
}else {
$date = $data[4];
}
if(empty($data[5])){
$statusErr = "Product name is empty";
$btnStatus = "DISABLED";
}else {
$status = $data[5];
}
echo "<input type = 'hidden' name = 'payeename[]' value ='$payeename'>";
echo "<input type = 'hidden' name = 'particular[]' value ='$particular'>";
echo "<input type = 'hidden' name = 'amount[]' value = '$amount'>";
echo "<input type = 'hidden' name = 'lddapada[]' value = '$lddapada'>";
echo "<input type = 'hidden' name = 'date[]' value = '$date'>";
echo "<input type = 'hidden' name = 'status[]' value = '$status'>";
echo "<tr>
<td>$payeename</td>
<td>$particular</td>
<td>$amount</td>
<td>$lddapada</td>
<td>$date</td>
<td>$status</td>

</tr>";
}
}
echo "<tr>
<td width='100%'>
<div align ='center'>
<input type = 'submit' $btnStatus name = 'btnAdd' value = 'Add this item'>
</div>
</td>
</tr>

</form>

";

echo "</table>";
}

?>
 
The warning you encountered is related to the maximum number of input variables allowed in PHP. By default, the limit is set to 1000, but your code seems to have exceeded this limit.

To resolve this issue, you need to increase the max_input_vars value in your php.ini file. Here's how you can do it:

1. Locate your php.ini file. This file is usually located in the PHP installation directory.

2. Open php.ini file in a text editor.

3. Search for the max_input_vars directive. If it does not exist, add the following line:
max_input_vars = 2000

You can adjust the value 2000 according to your needs.

4. Save the php.ini file and restart your web server.

After making these changes, the warning should no longer appear, and your code should work as expected.
 
The warning you encountered is related to the maximum number of input variables allowed in PHP. By default, the limit is set to 1000, but your code seems to have exceeded this limit.

To resolve this issue, you need to increase the max_input_vars value in your php.ini file. Here's how you can do it:

1. Locate your php.ini file. This file is usually located in the PHP installation directory.

2. Open php.ini file in a text editor.

3. Search for the max_input_vars directive. If it does not exist, add the following line:
max_input_vars = 2000

You can adjust the value 2000 according to your needs.

4. Save the php.ini file and restart your web server.

After making these changes, the warning should no longer appear, and your code should work as expected.
pwede ba syang gawin 1m
 
pwede ba syang gawin 1m
Increasing the max_input_vars value to 1 million may not be feasible or recommended in most cases. The purpose of this limit is to prevent excessive memory usage and potential security risks. Setting it to such a high value can potentially impact the performance and stability of your application.

If you truly require handling a large number of input variables, you should consider revisiting your code and optimizing it to reduce the number of variables being used. Alternatively, you can split your data into smaller chunks or use a more efficient data structure.

If you still need to increase the limit, you can try increasing the value gradually, monitoring the performance of your application, and adjusting as necessary. However, it's important to keep in mind the potential drawbacks and implications of such a high limit.
 

Similar threads

Back
Top