<?php
session_start();
include_once '../classes/db.class.php';
include_once '../classes/fc.class.php';

if($_SERVER['REQUEST_METHOD'] === 'POST') {

     // Dados recebidos via POST
     $data = $_POST;
     $tabela = 'itemserv';
   
   if(isset($_SESSION['uid'])){        

                 
        
         $con=DB::conecta();

         // Inserção no banco de dados
         $sql = "INSERT INTO ".$tabela." (" . implode(", ", array_keys($data)) . ") VALUES (:" . implode(", :", array_keys($data)) . ")";
         //echo $sql;
         $stmt = $con->prepare($sql);
         //echo $sql;
 
         if($stmt->execute($data)){
            $con=null;
            echo "ok";
         }else{
            $con=null;
            echo "erro";
         }





   }else{
      echo "erro";
   }



}else{
   echo "erro";
  // exit;
}

//    echo $sql;

?>