Need to pass column value as variable to external PHP form.
Need to pass column value as variable to external PHP form.
I'm looking at the example code in the "Cutomised control buttons" post. I want to set a variable equal to a column value in the selected table row and pass it as a parameter to a separate php form page. I am aware that I can create an action that opens the external page when the button is clicked.
Can I modify the following code in a way so that instead of updating the table row as for salary below I set a variable to the (editor.get('salary') value and pass it as a parameter to my separate form page (e.g., /formpage.php?salary=<variable>)?
Thanks.
buttons: [
{ extend: "create", editor: editor },
{ extend: "edit", editor: editor },
{
extend: "selectedSingle",
text: "Salary +250",
action: function ( e, dt, node, config ) {
// Immediately add `250` to the value of the salary and submit
editor
.edit( table.row( { selected: true } ).index(), false )
.set( 'salary', (editor.get( 'salary' )*1) + 250 )
.submit();
}
},
{ extend: "remove", editor: editor }
]
This question has an accepted answers - jump to answer
Answers
You don't really need to bother with the Editor aspect at all for that. You could just use:
Allan
Thank you, Allan! Works great!