 <?php
session_start();
require_once($_SERVER['DOCUMENT_ROOT'] . '/sys/db.php');

foreach ($_POST as $paramName => $paramValue) {
  if ($paramName == "selectid")
    $cf_id = $paramValue;
}

if ($cf_id > 0) {
  $dal = new DAL();
  $sql = "SELECT CF.id,        0 AS id_attr, " .
         "CF.menuitem_id,      '' AS menuitem_id_attr, " .
         "CF.controlobject_id, CO.control AS controlobject_id_attr, " . 
         "CF.field,            CF.field AS field_attr, " .
         "CF.formhandler_id,   '' AS formhandler_id_attr, " . 
         "1 AS complete_ind,   '' AS complete_ind_attr " .
         "FROM controlfield CF, controlobject CO " .
         "WHERE CF.id = $cf_id AND CO.id = CF.controlobject_id LIMIT 1 " ;
  $result = $dal->query($sql);
}

$_SESSION['controlfield'] = $cf_id;

echo json_encode($result);

?>

