Post-Vars doubled / corrupted
| From: | Sabine | Date: | Thu, 15 Dec 2005 12:26:47 +0000 |
| Subject: | Post-Vars doubled / corrupted | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-227464@lists.php.net to get a copy of this message | ||
Hello to all,
I distributed my app to a new server and suddenly had values saved twice in the db and so on.
I tracked it down and found out, that the problem is the content of $_POST.
Vars are doubled, Strings corrupted. Absolutely absurd.
I have no idea where to search for the reasons.
PHP-Version is 4.3.11
Does anybody else have an idea?
Thank you in advance
Sabine
A simple testcase:
<?php
echo "Post:";
var_dump($_POST);
?>
<html>
<body >
<form id="formular" action="<?=$_SERVER['PHP_SELF'] ?>" method="post">
<ul id="colors">
<li><input class="buttons" name="colors[]" id="id1" type="checkbox" value="1" title="chose color" /><label for="id1">red</label></li>
<li><input class="buttons" name="colors[]" id="id2" type="checkbox" value="2" title="chose color" /><label for="id2">blue</label></li>
<li><input class="buttons" name="colors[]" id="id3" type="checkbox" value="3" title="chose color" /><label for="id3">green</label></li>
<li><input class="buttons" name="colors[]" id="id4" type="checkbox" value="4" title="chose color" /><label for="id4">yellow</label></li>
</ul>
<fieldset class="nolegend">
<input type="submit" value="change colors" name="aendern" />
<input type="submit" value="save colors" name="speichern" />
</fieldset> </form> </body>
</html>
Output for $_POST, if you just click on "change colors":
Post: array(1) { ["aendern"]=> string(34) "change colorsaendern=change colors" }
Output, if you check only "red" and click "change colors":
Post: array(2) { ["colors"]=> array(1) { [0]=> string(1) "1" } ["aendern"]=> string(13) "change colors" }
output for 2 colors checked:
Post: array(2) { ["colors"]=> array(3) { [0]=> string(1) "1" [1]=> string(1) "2" [2]=> string(1) "2" } ["aendern"]=> string(13) "change colors" }