Hello guys.
I am faced with an serious issue in my current project.
I have this form, when the user submits it I create an array via javascript which is then encoded in with JSONstring.make().
The data is sent to php via ajax, the problem is that sometimes, I havn't found a common denominator, the data is recived and decoded with json_decode and then utf8_decode and when the query is executed all the data is empty. The data is allways correct before it's sent.

//K0ns3rv

Member Avatar for diafol

Do ya think ya could post yer code mista?

I have found the source of the problem:
The data is sent as a GET parameter to the ajax. I just encountered the error again and noticed that the url is correct like

http://thedomain/AJAX/HotelAjax.php?action=update&ID=39&clientData={%22name%22:%22Berns%20Hotell%22,%22street%22:%22N%E4ckstr%F6msgatan%208%22,%22zip%22:%2211147%20%22,%22city%22:%22%20Stockholm%22,%22phone%22:%2208-566%20322%2000?%22,%22fax%22:%22%22,%22mail%22:%22info@berns.se%22,%22contact%22:%22Berns%20III%22,%22parking%22:0,%22pParking%22:%22%22,%22garage%22:0,%22pGarage%22:%22%22,%22gym%22:1,%22pGym%22:%225840%22,%22spa%22:0,%22pSpa%22:%22%22,%22relax%22:0,%22pRelax%22:%22%22,%22pool%22:0,%22pPool%22:%22%22,%22bar%22:1,%22restaurant%22:1,%22smoking%22:0,%22pSmoking%22:%22%22,%22pets%22:0,%22pPets%22:%22%22,%22allergy%22:0,%22pAllergy%22:%22%22,%22exBed%22:0,%22pExBed%22:%22%22,%22internet%22:0,%22pInternet%22:0,%22comments%22:%22%22}

But after extracting the data using the following code:

$client = stripslashes($_GET['clientData']);
    $data = json_decode($client,true);

as well as utf8_decoding it. I found that it was all empty on the serverside, still havn't found a pattern to why this error occurs

Also in firedebug the parameters for clientData aren't reported.
//K0ns3rv

Member Avatar for diafol

We realized that _GET method probably ain't all that good for queries, switched to POST, havn't seen the error yet, but thanks anyways mate.

Member Avatar for diafol

Da nada

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.