<?php

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

foreach ($_POST as $paramName => $paramValue) {
  if ($paramName == "optionsid")
    $oc_id = $paramValue;
}

$dal = new DAL();
$sql = "SELECT OC.id, name AS text " .
       "FROM organizationcontact OC, organization OZ, organizationcontact OC1 " .
       "WHERE OC1.id = $oc_id AND OC.contact_id = OC1.contact_id " .
       "AND OZ.id = OC.organization_id " ;
$result = $dal->query($sql);

echo json_encode($result);

?>

