I am passing an object into a PHP script like this:
$http({
method: 'POST',
url: 'updateCoins.php',
data: {flips: $scope.data.flips, error: $scope.data.pe},
})
In my PHP script I tried:
$data = file_get_contents("php://input");
and
$data = json_decode(file_get_contents("php://input"));
I then tried echoing back the received value like this:
echo $data.flips
or
echo $data[flips]
or
echo $data->flips
I keep on getting either a blank result or the word "flips" back. How do I access those variables?
echo $_POST['flips'];$_POSToverphp://input, especially if you're sending JSON -- you're fine with what you're doing there already. Try dumping$datato see what's actually in it