I have an array of data sent by jquery ajax to a php service:
requestAjax = jQuery.ajax({
type: "POST",
url: "ajax/ajax.salva-valutazione.php",
data: {formdata:formdata, arrAccessori: arrAccessori},
// data:formdata,
dataType: "json",
success: function(risposta){
alert(".."+risposta);
}
});
In the php response page I use, if I do a print_r of all data:
error_log(print_r($arrValutazione, TRUE) );
I get in error log:
[formdata] => nome=John&cognome=Doe&indirizzo=My+address&citta=London&user_name=fedepupo&clienteID=1
While if I do
error_log(print_r($arrValutazione['formdata'], TRUE) );
I obtain
nome=John&cognome=Doe&indirizzo=My+address&citta=London&user_name=fedepupo&clienteID=1
In error log.
My problem is how direcly accessing nome, cognome (...) values because if I try doing
error_log(print_r($arrValutazione['formdata']['cognome'], TRUE) );
I get 'n', and also with
error_log(print_r($arrValutazione['formdata'][0]['cognome'], TRUE) );
I get the same value 'n'.
Any suggestions?