The dataprocessor is working in my application, but I had to hard-code the MySQL table in the PHP code. I want to be able to send a table name because it will change depending on what the user is doing on the website. Is there a way to do this?
The end result would be something like this:
$table = $_GET['table'];
You can use
$some->render_table($_GET['table']);
but such code results in tremendous hole in the system security. As it will be possible to read data from ANY table.
This is for an internal site, so I don’t care about security.
How do I send the table with javascript? I know how to get the variable in PHP, but I can’t figure out how to send a variable with javascript that isn’t part of the grid. The dataprocessor is only sending grid data, but I need to add an extra variable. Normally, I could do it like this:
grid.load("file.php?table=" + table);
but I don’t know how to pass the table variable with the dataprocessor call because it isn’t part of my grid.
You have dataprocessor object, assigned to the grid, right ?
So you can change its server side url like next
dp.serverProcessor = "save.php?table="+table;
or if you not need to change it dynamically, just provide it during dataprocessor initialziation
var dp = new dataProcessor("save.php?table="+table);
dp.init(mygrid)
Oh, that makes sense. Thanks for the quick response!