Jump to content

Recommended Posts

English is not my native language; please excuse typing errors.

 

I have a very strange problem with a HTML form that use checkbox arrays. It is a simple checkbox code in a real site in Russian language, where I help to my frend to fix:

http://astrabis.ru/teoria/test2.php

 

The host has the PHP Version 5.3.13.

 

This code, YES works in my local PC (Windows 7), with installed Xamp Appache, PHP Version 5.6.3.

 

Problem description.

A client side file test2.php has a checkbox form and it is shown perfectly on a browser. The form fill some arrays according to checked boxes.

 

But when I check some of them and press Submit, I do not see any data moving to a testrez2.php file (it processes the form). I put additional debugging code (see below) and it shows me that no any array was received

 

Details.

File test2.php

-- charset=windows-1251" --

-- --

 

There are three arrays of check boxes: vata[] pita[] kapha[] (note its text is in Russian and you see some strange signs or '?'):

----

The file of the result processing, testrez2.php, has some simple mathematic and I added some "print_r" and "echo" code to debug the problem.

 

So the "print_r" prints error messages, pointing that arrais do not exist.

 

More of that, historically, I started to work with another file from the site testrez3.php that has almost the same code. The file is activated by test3.php.

 

The pair test3.php and testrez3.php are worked several days and stopped with the same problem!

 

Also I did some experiments:

--I also changed the method from POST to GET in files test2.php testrez2.php. I wanted to see in the address line of my browser that the checkbox data is really sent to the server. It is sent! But the testrez2.php also does not receive any data.

 

See below the match of two "gets": real site and my 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

 

--I tested the form, adding new attribut

'enctype = text/plan'

--and also

'enctype =application/x-www-form-urlencoded

No results.

--I tested the client's code on 4 types of internet explorers.

No results.

PLEASE HELP!

testrez2.php

test2.php

Nothing stands out as me as being wrong. The odd characters make it a little hard to read, but everything seems to be there that should be.

 

A few thoughts:

 

1. A checkbox that is not checked will not be sent in the POST/GET data. I assume you are checking at least one value in the groups of checkboxes - else the array errors you are receiving would be correct.

 

2. It's possible that the character encoding is causing a problem. You could always try just using normal ASCII character isntead of Russian to verify if that is the problem

 

3. Why not just do a print_r($_POST) to verify exactly what IS sent in the form submission.

Guru, let me answer in the same order as you write above.

 

1. Of course the check boxes were checked. In may post I did not find how to activate a new line or text formating. Let me show one item from my post:

See below the match of two "gets": real site and my 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

 

This was my GET experiment, where you see filling of the arrays when checkboxes were checked.

 

2. I thing that it is the character encoding, but see by experiments whith the 'enctype' attribute of the FORM. Nothing helps.

More of that, as I noticed in my post, I started to work with pair of files test3.php and testrez3.php and almost the same code fragment with FORM worked several days and stopped. WAY??. After that owner of the site asked me to debug the current test2.php and testrez2.php. There did not work at beginning.

 

3. Regarding print_r. Please see attached the testrez2.php file. There I print x,y,z using echo. The x,y,z = 0. That is arrays are empty

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.