Unable to set $_SESSION['username'] value in editor [fields: [ { label: "",name:"",def: ""}]
Unable to set $_SESSION['username'] value in editor [fields: [ { label: "",name:"",def: ""}]
praveen21singh
Posts: 1Questions: 1Answers: 0
in Editor
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
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