I am trying to load a grid with a SQL string. You advised using a session variable. However, I cannot get the load working even using the $_SESSION super global.
I tried using this:
if (!empty($_POST[“ServiceID”]))
{
$_SESSION[“ServiceID”] = $_POST[“ServiceID”];
}
else
{
$_SESSION[“ServiceID”] = “0”;
}
$serviceid = $_SESSION[“ServiceID”];
with this:
$grid->set_options($opt);
if ($serviceid == “0”) {
$grid->select_command = “SELECT ID, instance_date, serviceID FROM serviceinstances”;
}
else {
// $grid->select_command = “SELECT ID, instance_date, serviceID FROM serviceinstances WHERE ID = “.$serviceid;
$grid->select_command = $sql;
}
$grid->table = “serviceinstances”;
Any thoughts?
It DOES work with GET and I don’t need to use a session variable so it looks like an issue with POST vs GET…