The data being passed through by the AJAX script is (for example):
action: download_report
params[report]: CP
params[btn]: gt_run_report
params[params][0][name]: categories
params[params][0][value][]: 5
params[params][1][name]: structureID
params[params][1][value]: 5
params[params][2][name]: extraAwardNames
If i print out the whole $_POST so you can see the data coming through on the script side:
Array ( [action] => download_report [params] => Array ( [report] => CP [btn] => gt_run_report [params] => Array ( [0] => Array ( [name] => categories [value] => Array ( [0] => 5 ) ) [1] => Array ( [name] => structureID [value] => 5 ) [2] => Array ( [name] => extraAwardNames ) ) ) )
The optional param is being done as:
$params = optional_param_array('params', false, PARAM_TEXT);
$action = optional_param('action', false, PARAM_TEXT);
If I were to remove the params['params'] array from the data being passed through then this would work fine, as optional_param_array seems to loop through each element in the array and run clean_param() on it, assuming it's a string.
But with an array of arrays, like this, I get:
Coding error detected, it must be fixed by a programmer: clean_param() can not process arrays, please use clean_param_array() instead.
Is there any way to do this, using the optional_param* methods, and leaving my data intact? Or am I going to have to completely change how I am sending data through, to remove these multidimensional arrays?
Thanks.