<?php
// Values received via ajax
$title = $_POST['title'];
$ypid= $_POST['ypid'];
$start = $_POST['start'];
$end = $_POST['end'];
$url = $_POST['url'];
// connection to the database
try {
 $bdd = new PDO('mysql:host=localhost;dbname=fullcalendar;charset=utf8', 'root', '');
 $bdd -> exec("SET CHARACTER SET utf8");
$bdd ->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
} catch(Exception $e) {
exit('Unable to connect to database.');
}

// insert the records
$sql = "INSERT INTO evenement (title,ypid,start, end, url) VALUES (:title,:ypid, :start, :end, :url)";
$q = $bdd->prepare($sql);
$q->execute(array(':title'=>$title ,':ypid'=>$ypid , ':start'=>$start, ':end'=>$end,  ':url'=>$url));
?>
