<?php

include("./access.php");

if(isset($_POST['cle'])&&($_POST['cle']!='')&&($_POST['titre']!=''))
{

 $queradd = "UPDATE planning SET
 jour='".$_POST['jour']."',
 heure='".$_POST['heure']."',
 heurefin='".$_POST['heurefin']."',
 lieu='".$_POST['lieu']."',
 theme='".$_POST['theme']."',
 intervenant='".$_POST['intervenant']."',
 titre='".addslashes($_POST['titre'])."',
 description='".addslashes($_POST['description'])."',
 valid='".$_POST['valid']."',
 onoff='".$_POST['onoff']."',
 type='".$_POST['type']."',
 referent='".$_POST['referent']."',
 secretaire='".$_POST['secretaire']."',
 rapporteur='".$_POST['rapporteur']."'
 WHERE cle='".$_POST['cle']."'";
  $resultadd = mysqli_query($connect,$queradd);

    header("location: index.php#".$_POST['cle']);
}
else
{

 $queradd = "INSERT INTO planning SET
 jour='".$_POST['jour']."',
 heure='".$_POST['heure']."',
 heurefin='".$_POST['heurefin']."',
 lieu='".$_POST['lieu']."',
 theme='".$_POST['theme']."',
 intervenant='".$_POST['intervenant']."',
 titre='".addslashes($_POST['titre'])."',
 description='".addslashes($_POST['description'])."',
 valid='".$_POST['valid']."',
 onoff='".$_POST['onoff']."',
 type='".$_POST['type']."',
 referent='".$_POST['referent']."',
 secretaire='".$_POST['secretaire']."',
 rapporteur='".$_POST['rapporteur']."'";
  $resultadd = mysqli_query($connect,$queradd);
  
    header("location: index.php");
}


?>