$scope.informations = [
{
"name": "asd",
"rg": "1123",
"certificado": null,
"sex": null,
"date": null
},
{
"name": "fsdf233412423",
"rg": "123123",
"certificado": null,
"sex": null,
"date": null
},
{
"name": "d23423423423423423",
"rg": "123123123123123123",
"certificado": null,
"sex": null,
"date": null
}
];
$scope.enviar = function(){
var url = 'gerar-algo.php';
var informations = $scope.informations;
$http ({
method: 'POST',
url: url,
params: {
data: informations
}
}).then (function (data, status, headers, config) {
alert(JSON.stringify(data));
});
};
PHP
$data = json_decode($_POST['data'], true);
foreach($data as $valor){
echo $valor;
}
You are returning the error:
Undefined index: data