Pass php variable on submit

Pass php variable on submit

pcsintjanbaptistpcsintjanbaptist Posts: 20Questions: 9Answers: 1

I'm stuck with an editor page with php variable.

I use a php variable in my where clause. This works fine when loading the table because the variable is passed in my ajax call as data. But when i try to edit the record i get an error because of the variable that is not set.

How can i give a PHP variable with my submit form event.

This is what i have as a where clause

The parameter is passed with the post data in the ajax call
$EmailLDAP = $_POST['emailldap'];

Then in my where clause i use this for getting the correct records
**->where('table.field1',$EmailLDAP,'=') **

This value is correct when i load the table but when i edit a record, the parameter isn't set because there is no new ajax call.

I thought of using the folowing code. But don't know how to give the Post parameter

**editor.on( 'initSubmit', function () {

});**

Thanks for any help you can give.

Answers

  • allanallan Posts: 63,512Questions: 1Answers: 10,472 Site admin

    You need to send the variable with the Editor request as well as the DataTables data fetch request (they are two independently configured Ajax objects). The preSubmit event can be used to do this in Editor, or ajax.data just like the DataTables one (which I presume you are using for the DataTables Ajax configuration?).

    Regards,
    Allan

This discussion has been closed.