<?php

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

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

if ($ca_id > 0) {
  $dal = new DAL();
  $sql = "SELECT id, " .
         "controlfield_id, '' AS controlfield_id_text, " . 
         "attribute,  attribute AS attribute_text, " .
         "value,     value AS value_text " .
         "FROM controlattr " .
         "WHERE id = $ca_id LIMIT 1 " ;
  $result = $dal->query($sql);
}

$_SESSION['controlentry'] = $ca_id;

echo json_encode($result);

?>

