PHP POST总是得到HTML表单的默认值

I'm working on some extensions to a 20 year old PHP code. Now I needed to add a new text input field and process the data as in all previously existing text input fields. Evrything works fine except for this new input.

I've got a HTML form:

<form action="form.php?<?php echo SID; ?>" method="post">
  <?php echo "<div id=\"inputheader-title\"><input type=\"text\" name=\"".$new.$i.'[position_new]'."\" size=\"3\" maxlength=\"2\" value=\"".$i."\">. Entry</div>"; ?>
  [...]
<input class="button" type="image" src="<?php echo $HTML_IMG; ?>/send.png">
</form>

[...] denotes further input fields, which are all working fine. All text input fields are using the same pattern.

The source code for the text field within my browser looks like this:

<input type="text" name="old1[position_new]" size="3" maxlength="2" value="1">

Which looks fine to me. But when I send the form data the value for old1[position_new] is always default in PHP's $_POST. All other data is correct (as inserted into the form fields). I checked that with var_dump($_POST)

When I examine the data sent by the browser I can see the modified value, but when it comes to PHP the data seems altered, despite it isn't processed any further.

In short: I entered: 3

Default value is: ["position_new"]=> string(1) "1"

The browser shows: ["position_new"]=> string(1) "3"

var_dump($_POST) shows: ["position_new"]=> string(1) "1"

PHP transforms fields with [] in name into an array. If you don't want this, remove [ and ] from field name.

<?php
  var_dump($_REQUEST);
  echo '<pre>'.print_r($_REQUEST,true).'</pre>';
?>
<form action="/test.php" method="post" name="myform">
  <input type="text" name="old1[position_new]" size="3" maxlength="2" value="1">
  <input type="text" name="old1[art]" size="15" maxlength="50" value="Lecture">
  <input type="submit" name="save" value="save">
</form>

In this example, with your fields names, array is correctly populated. Check for a duplicate field with same name with a default value in your html code.