<?php session_start();
if(!empty($_SESSION['admin_connect_id']))
{ require('../../config.php');

date_default_timezone_set('Africa/Algiers');
$d_aj=date('Y-m-d H:i:s');
$nom=mysqli_real_escape_string($con,htmlspecialchars(trim($_POST['nom']))) ;
$nomar=mysqli_real_escape_string($con,htmlspecialchars(trim($_POST['nomar']))) ;
$unite=mysqli_real_escape_string($con,htmlspecialchars(trim($_POST['unite']))) ;
$destination=mysqli_real_escape_string($con,htmlspecialchars(trim($_POST['destinations']))) ;
$added_by=$_SESSION['admin_connect_id'];

$sql2 = "INSERT INTO parcours (parunite,parnom,parnomar,pardest,parcadded_by,parcreated_at,parupdated_at) VALUES 
('$unite','$nom','$nomar','$destination','$added_by','$d_aj','$d_aj')";

  if(mysqli_query($con,$sql2)){
  $last_id = mysqli_insert_id($con);
  echo $last_id;
  } else {
echo 0;
 }

    }

?>