<?php
session_start();

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

if (isset($_SESSION['spatialunit'])) 
  $su_id = $_SESSION['spatialunit'];
else
  $su_id = 0;

foreach ($_POST as $paramName => $paramValue) {
  if ($paramName == "id")
    $relatedlot_id = $paramValue;
  elseif ($paramName == "currid") 
    $sl_id = $paramValue;  
  elseif ($paramName == "val") 
    $re_id = $paramValue;  
}

$dal = new DAL();

$st_id = hexdec(uniqid());
 
$sql = "INSERT INTO stratigraphy " .
       "(id, spatialunitlot_id, relatedlot_id, relationship_id) " .
       "VALUES ($st_id, $sl_id, $relatedlot_id, $re_id) ";
$result = $dal->query($sql);

echo json_encode($result);

?>

