I am using this jQuery code to send data to PHP:
var fromdata2 = $('#form').serialize();
var file_data = $('#fileid').attr('files')[0];
var fromdata = new FormData();
fromdata.append('fileid', file_data);
fromdata.append('post_data', fromdata2);
$.ajax({
type: "POST",
cache: false,
contentType: false,
processData: false,
data: fromdata,
dataType: "json",
url: "url",
success: function (data)
{
alert("success");
}
});
I receive the data in this form:
code=&id=&CTR_ID=&ctr_name=asdsadsad&air_name=Action+Airlines&air_uniCode=XQ&ctr_strDate=04%2F11%2F2017&ctr_endDate=04%2F11%2F2017&ctr_docNameHid=5337XXXXXXXXXX78_09-06-2016&recstatus_val=1
But when I attempt to process it, with this code:
var_dump(unserialize($data));
I receive this error:
unserialize(): Error at offset 0 of 537 bytes.
How can i unserialize it, to find the result in an array, like this:
array(
code=>,
id=>,
CTR_ID=>,
ctr_name=>'asdsadsad'
)