html - PHP code with check box arrays does not work in real site but works in local host -


english not native language; please excuse typing errors.

i have strange problem php code, using checkbox arrays. simple checkbox code in real site in russian language, frend fix: http://astrabis.ru/teoria/test2.php

the host has php version 5.3.13.

but code, yes, works in local pc (windows 7, installed xamp appache) php version 5.6.3. has been installed php server debug problem describe here.

problem description. check boxes in file test2.php shown on browser, when check of them , press submit, server not move data testrez2.php file processes data.

details. in file test2.php there 3 arrays of check boxes: vata[] pita[] kapha[] test2.php code fragments:

<!doctype html> <html> <head> ... <meta http-equiv=content-type content="text/html; charset=windows-1251" /><meta name=viewport content="width=device-width, initial-scale=1" /> ... </head> ... <form action="http://www.astrabis.ru/teoria/testrez2.php" method="post"> ... <table cellspacing="1px"> <tbody> <tr><td rowspan="3">????</td><td><input name="vata[]" type="checkbox" value="2">???????, ??????????; ???????????, ??????????? ?? ???????? ?????????, ???????????? ????????, ??????? ? ??? ?????? ? ? ??? ??????.</td></tr> <tr><td><input name="pita[]" type="checkbox" value="2">???????????, ?????????????????, ????????????, ?????? ????, ????? ???????. ???????????? ???. ???????????? ???????? ? ????, ???? ??????? ??????? ???? ?? ????????????????? ????????.</td></tr> <tr><td><input name="kapha[]" type="checkbox" value="2">?????????, ??????, ??????????, ?? ???????????? ???????.</td> ... ... <tr><td rowspan="3">?????</td><td><input name="vata[]" type="checkbox" value="2">??????????? ? ????? ? ???????????.</td></tr> <tr><td><input name="pita[]" type="checkbox" value="2">??????????? ? ?????????? ???????????, ?????? ?????????.</td></tr> <tr><td><input name="kapha[]" type="checkbox" value="2">??????????? ? ????????????? - ????????,???????? ? ?.?.</td> </tr> </tbody> </table> 

the file of result processing, testrez2.php, has simple matematic, added debug code see input data , other info testrez2.php code fragments:

... <?php echo "<br>vata : "; print_r(array_values($_post['vata'])); echo "<br>pita : "; print_r(array_values($_post['pita'])); echo "<br>kapha : "; print_r(array_values($_post['kapha']));  $x=0; $y=0; $z=0;  if (isset($_post['vata'])) {$x=array_sum($_post['vata']);}  if (isset($_post['pita'])) {$y=array_sum($_post['pita']);}  if (isset($_post['kapha'])) {$z=array_sum($_post['kapha']);}  $sum=$x+$y+$z;  //debug echo "<br>x : $x"; echo "<br>y : $y"; echo "<br>z : $z"; echo "<br>sum : $sum"; 

more of that, historically, started debug file site , added same code in file testrez3.php, (it activated test3.php of same real url). same debug printing code shown in file testrez2.php above.

the pair test3.php , testrez3.php worked several days , stopped same problem!

i shanged method post in files test2.php testrez2.php (). wanted see in address line of browser chrome checkbox data sent server. sent! testrez2.php not receive data.

see below match of 2 "gets": real site , pc local host

localhost/astrabis/astrabis.ru/test/testrez2.php?vata%5b%5d=2&pita%5b%5d=2&kapha%5b%5d=2&vata%5b%5d=2&pita%5b%5d=2&kapha%5b%5d=2

astrabis.ru/teoria/testrez2.php?vata%255b%255d=2&pita%255b%255d=2&kapha%255b%255d=2&vata%255b%255d=2&pita%255b%255d=2&kapha%255b%255d=2

look @ difference:

pita%5b%5d=2 

locally vs:

pita%255b%255d=2 

if urldecode pita%5b%5dyou pita[] other 1 double urlencoded, if decode once pita%5b%5d. problem. should check double urlencode comes from. don't see in code posted maybe server setting.


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -