<?php
session_start();
require('../45789417/ref4780.php');
if (!isset($_SESSION['userid'])) {
  echo "<script language='Javascript'> location.href='login.php';</script>";
    exit();
  };
$id = $_POST['id'];
$status =  $_POST['status'];
$comments = $_POST['comments'];
$day_view = $_POST['day_view'];
$month_view= $_POST['month_view'];
$year_view = $_POST['year_view'];

// connection to the database
require_once('4798945.php');
echo $day_view;
echo $month_view;
echo $year_view;
 // update the records	
	
	$sql = "UPDATE se_evenement SET status=?, comments=? WHERE id=?";
	$q = $bdd->prepare($sql);	
	$q->execute(array($status,$comments,$id));	
	if ($status == "Reagendado"){
		echo "<script type='text/javascript'>  
				window.location='agenda.php';
			</script>";
	} else {
		echo "<script type='text/javascript'>  
			window.location='reports_list.php?day_view=$day_view&month_view=$month_view&year_view=$year_view&update=ok';
			</script>";
	}
?>