Send form data get back JSON data not working

I give up!

How do you make this work???

I am trying to send post data to my web page like this:

And trying to retrieve a JSON object in return like this:

The 'JsonTextDecodeWithDictionaries' is not working with the data that my PHP code is sending to my app. My notifier popup is displaying 'not found' after the "\n##############\n". So that means local variable 'member' is empty and .JsonTextDecodeWithDictionaries is failing to decode the PHP generated JSON string. Why dammit?

Testing my web page in a web browser:


Page Contents:
I get the same data in a Notifier popup in my app so my web page is sending the app the JSON data as expected.

"business_name":"Greg's Native Landscapes",
"abn":"51 824 753 556",
"structure":"Sole trader",
"license":"Electrical license\r\nClass A\r\nNumber: 8743895324"
"description":"Ecological weed control\r\nLow maintenance\r\nDrought tolerant\r\nIrrigation systems\r\nSmall retaining walls\r\nSmall tree removal\r\nGeneral pruning\r\nBush tucker gardens\r\nSmall ornamental billabongs\r\nNative lawns",
"maximum_size":"Up to 50",
"unit":"Unit 3, building 6(Cooper)",
"street":"56 Derby Drive",
"password":"{\"ct\":\"9PuKHhy9VLrfbNt+4XMBTQ==\",\"iv\":\"25666ca790a3be3cd825b0f4d3927ecb\",\"s\":\"c4165aa358be74dd\"} ","logo_filename":"Logo.jpg",

Page source code:


	require_once "CryptoJSAES.php";
	require_once "common.php";

	if (isset($_GET["button"]))
		$_POST = $_GET;
	if (isset($_POST["button"]))
		if ($_POST["button"] == "LOGIN")
			$strQuery = "SELECT * FROM members WHERE username='" . $_POST["username"] . "' OR email='" . $_POST["username"] . "' AND password='" . CryptoJsAes::encrypt($_POST["password"], $g_strKey) . "'";
			$result = DoQuery($g_dbFindATradie, $strQuery);
			if ($result->num_rows == 1)
				$row = $result->fetch_assoc();
				$member = (object)[];
				$member->id = $row["id"];
				$member->trade = (int)$row["trade_id"];
				$member->business_name = $row["business_name"];
				$member->first_name = $row["first_name"];
				$member->surname = $row["surname"];
				$member->abn = $row["abn"];
				$member->structure = $row["structure"];
				$member->license = $row["license"];
				$member->description = $row["description"];
				$member->minimum_charge = $row["minimum_charge"];
				$member->minimum_budget = $row["minimum_budget"];
				$member->maximum_size = $row["maximum_size"];
				$member->maximum_distance = $row["maximum_distance"];
				$member->unit = $row["unit"];
				$member->street = $row["street"];
				$member->suburb = $row["suburb"];
				$member->state = $row["state"];
				$member->postcode = $row["postcode"];
				$member->phone = $row["phone"];
				$member->mobile = $row["mobile"];				
				$member->email = $row["email"];
				$member->expiry_date = $row["expiry_date"];
				$member->username = $row["username"];
				$member->password = $row["password"];
				$member->logo_filename = $row["logo_filename"];
				$member->profile_filename = $row["profile_filename"];
				// Next we need to get the listb of additional trades.
				$member->additional_trades = [];
				$result = DoFindQuery1($g_dbFindATradie, "additional_trades", "member_id", $member->id);
				if ($result->num_rows > 0)
					while ($row = $result->fetch_assoc())
						$member->additional_trades[] = $row["trade_id"];
				echo json_encode($member);
		else if ($_POST["button"] == "")


Cannot see a key called trade_id in your JSON.

I eventually spotted it....doh!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.