Unable to set $_SESSION['username'] value in editor [fields: [ { label: "",name:"",def: ""}]

Unable to set $_SESSION['username'] value in editor [fields: [ { label: "",name:"",def: ""}]

praveen21singhpraveen21singh Posts: 1Questions: 1Answers: 0

I have session variable as $_SESSION [ 'username']

Want to set it as default based on logged in username when NEW entry is made.

editor = new $.fn.dataTable.Editor( {
ajax: "../../controllers/staff.php",

    table: "#example",
    },

    fields: [ {
            label: "Site Name:",
            name: "sitename",
            def: $_SESSION [ 'username']

        }, 

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Looks like you are putting PHP code into Javascript there. Do you have PHP generating the Javascript? Can you link to a page showing the issue?

    Allan

Sign In or Register to comment.