Editor server side PHP nested $_POST

Editor server side PHP nested $_POST

crcucbcrcucb Posts: 63Questions: 19Answers: 0

Newbie here, been working with datatables for a few weeks with a MSSQL back end. Now I am working with the editor and in the server side PHP, the value of $_POST seems to be nested arrary and I am not sure how to navigate or read the values.

In sites.php, when I write out the value of $_POST to a file, this is what I see:
array (
'data' =>
array (
48 =>**
array (
'DTIndexAID' => '48',
'AddressSort' => 'ABBEY RD 15',
),
),
'action' => 'edit',
)

Here is the code in my HTML:
$(document).ready(function() {
var siteEditor = new $.fn.dataTable.Editor({
ajax: "/ajax/data/sites.php",

    fields: [

            {label: "DTIndexAID:",name: "DTIndexAID"},
                {label: "AddressSort:",name: "AddressSort"}

    ],
            table: "#parentTable",
    idSrc: 'DTIndexAID'
});

var siteTable = $("#parentTable").DataTable({
    ajax:{
        url: '../ajax/data/dt6.php',
        method: 'Post',
        contentType: 'application/json'
    },
       processing: true,
       serverSide: false,

     columns: [
    {
        className: 'details-control',
        orderable: false,
        data: null,
        defaultContent: ''
    },

            { data: 'AddressSort'}  ,
            { data: 'DTIndexAID'},
            { data: 'AddressAID'},
            { data: 'StreetName'},
            { data: 'AddressNumber'},
            { data: 'Address2'},
            { data: 'Ward'},
           { data: 'District'},
            { data: 'NorS'},
               { data: 'AddressNotes'},
            { data: 'Lat'},
            { data: 'Long'},
           { data: 'AddressInactive'},
           { data: 'ResidentAID'},
            { data: 'ResidentAddressAID'},
            { data: 'LastName'},
            { data: 'FirstName'},
            { data: 'Middle'},
            { data: 'Party'},
            { data: 'Phone'},
            { data: 'email'},
            { data: 'Gender'},
            { data: 'DOB'},
            { data: 'SuperVoter'},
                            { data: 'ResidentInactive'},
            { data: 'ResidentNotes'},
            { data: 'FullName'}

],
order: [[1, 'asc']],
rowId: 'DTIndexAID',
stateSave: true,
paging: true,
scrollCollapse: true,
scrollY: '50vh',
lengthMenu: [10, 25, 50, 100, 500, -1],
scrollX: true,
select: {
    style: 'single',
    selector: 'td:not(:first-child)'
},
layout: {
    topStart : {
            buttons: [
                { extend: "edit", editor: siteEditor },

                'searchPanes'

            ]
        },
    bottomEnd: {
        paging: {
            firstLast: false
        }
    }
}



});

This question has an accepted answers - jump to answer

Answers

Sign In or Register to comment.