I can't seem to get multiple parameters to work on sub-grids.
I am using your examples as a starting point – but the second variable does not seem to pass into the sub-report correctly.
It seems the only way I can keep a variable passed is to use $_REQUEST['rowid'].
I do not understand why I cannot use a separate sub-grid and pass-in the $_POST[].
Any advice would be appreciated.
Main page:
$grid["subGrid"] = true;
$grid["subgridurl"] = "shelf_life_sub.php";
$grid["subgridparams"] = "PART_ID,ID,LOCATION_ID";
And on the Sub-grid page:
$partid= $_POST["PART_ID"];
$traceid=$_POST["ID"];
$grid->select_command = "SELECT DATA1, DATA2, DATA3 FROM TABLE WHERE PART_ID = '$partid' AND TRACE_ID = '$traceid'";
I am working on this issue and will be updating it soon.
Current process is to persist the POST data in session and then use in query.
if (!empty($_POST["personid"]))
{
$_SESSION["personid"] = $_POST["personid"];
}
$pid = $_SESSION["personid"];
and use `$pid` in your SQL.
Thanks for the reply.
I tried many, many combinations of trying to use $_SESSION variables without success – it was getting rather frustrating.
I just used your method (with the (!empty())but it still seems to be generating incorrect data as I switch from one-field to the next (the POST is not replacing itself – it seemed to work the first-time, but not as I click on each additional field).
Do you think I need to clear the session at some-point?
Thanks for the support.
Mike
I have a better explanation of what's happening (now that I've had a chance to implement your method with the !empty().
I have two keys to check – PART_ID and ID.
The PART_ID corresponds to the $_GET['rowid'] field.
It is returning multiple values (say 10).
The ID corresponds to the $_POST['ID'] field. It is returning the secondary value (why there are 10-versions of the Part ID).
When I run the sub-report – the $_POST['ID'] is actually the last-entry in the list for every instance of the PART_ID. So the same sub-grid appears no-matter which Part ID you select.
I hope that makes sense.
Any thoughts?
Thanks
Mike