Php阵列发布错误

I have an array with 1200 records, But when I submit the form the code counts 250 records in the array. Why?

This is the code:

<?php
if (isset($_POST['ok'])) {
    echo count($_POST['precios']);
    // showme only 250 récords
}
?>
<form method='POST' action='productos.php'>
    <button class="btn green"  type="submit" name="ok"> Actualizar de forma masiva</button>
    <?php
    $query4334x = "select * from Productos";

    $result_categorias4334x = mysql_db_query($dbname, $query4334x)
        or die("Failed Query of " . $query4334x);  //guardo en una variable los registros obtenidos con el query

    $numero5 = mysql_num_rows($result_categorias4334x);
    echo $numero5;
    // showme 1200 récords

    while ($row = mysql_fetch_array($result_categorias4334x)) {
        $precio = $row['Precio'];
        ?>
        <input type="text" name="precios[]" value="<?php echo $precio; ?>">
        <?php
    }
    ?>
</form>

If you can't change settings in your php.ini max_input_vars and post_max_size

Try Something like below which works for me

implode() the array into one long string and explode() it on the server side.

json_encode() could probably work as well.

Example:

while ($row = mysql_fetch_array($result_categorias4334x)) {
        $precio[] = $row['Precio'];
    }
<input type="text" name="precios" value="<?php echo implode(",",$precio); ?>">

//POST

<?php
if (isset($_POST['ok'])) {
    $precios = $_POST['precios'];
    $preciosarr = explode(",", $precios);
    print_r($preciosarr);
}
?>

NOTE: The maximum number of characters allowed in the element. Default value is 524288

If this is part of a loop, you need to index the array

for ($i = 0; $i < count($_POST['precios']); $i++) { ?>
    ...
    <input type="text" name="precios[]" value="<?php echo $precio; ?>">
    ...
    <?php
}

also check this instead of echo use print_r() or var_dump()

print_r( count($_POST['precios']));

Please try to update following settings in your php.ini

max_input_vars = 1500

post_max_size = 64M

You just adjust both the variable according to your needs.

If you dont have access to php.ini you can try setting them in .htaccess

php_value  max_input_vars  1500   
php_value  post_max_size   64M