<?php

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

foreach ($_POST as $paramName => $paramValue) {
  if ($paramName == "selectid") 
    $project_id = $paramValue;  
  else if ($paramName == "text") 
    $pif_descr = $paramValue;  
  else if ($paramName == "id") 
    $pi_id = $paramValue;  
}


$dal = new DAL();

$pi_id = hexdec(uniqid());    

$sql = "INSERT INTO pif (id, project_id, pif_descr) " .
         "VALUES ($pi_id, $project_id, '$pif_descr') " ;
$result = $dal->query($sql);

echo json_encode($project_id);

?>

