What's new

Pano to mag fix

loktoy

Eternal Poster
Joined
Oct 20, 2014
Posts
1,168
Solutions
2
Reaction
103
Points
497
Age
30
kanina error nya is ganito

Warning: Unknown: Input variables exceeded 1000. To increase the limit change max_input_vars in php.ini. in Unknown on line 0

pero nun binago na ito ulit error

Warning: Unknown: Input variables exceeded 2000. To increase the limit change max_input_vars in php.ini. in Unknown on line 0
kahit binago ko na yun yan pa rin error..
ito pala 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 error message you are getting is related to the number of input variables in your code. By default, PHP has a limit on the number of input variables that can be submitted in a single request. In your case, the limit is set to 1000, which is causing the error.

To fix this issue, you need to increase the max_input_vars value in your php.ini file. You mentioned that you already tried changing it to 2000, but the error still persists. This could be because the changes you made to php.ini are not being applied properly.

Here are the steps you can follow to correctly increase the max_input_vars value:

1. Locate your php.ini file. The location of this file may vary depending on your server setup. You can try searching for it in the PHP installation directory or check your server's documentation.

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

3. Search for the max_input_vars directive. It should be commented out by default with a ; at the beginning of the line.

4. Remove the ; and set the value to a higher number. For example, you can set it to max_input_vars = 5000.

5. Save the changes to php.ini and restart your web server for the changes to take effect.

After increasing the max_input_vars value and restarting your server, try running your code again and see if the error persists. If it does, please double-check that you made the changes in the correct php.ini file and that the server was restarted properly.
 

Similar threads

Back
Top