You are here: Post-Vars doubled / corrupted « PHP « IT news, forums, messages
Post-Vars doubled / corrupted

Posted by Sabine on 12/15/05 14:26

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" />&nbsp;&nbsp;&nbsp;
<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" }

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация