<?php 
session_start();

if (isset($_SESSION["user_id"]) and isset($_SESSION["password"])) {
	$dbhost=$_SESSION["dbhost"];
	$dbuser=$_SESSION["dbuser"];
	$dbpass=$_SESSION["dbpass"];
	
	$id=$_SESSION["user_id"];
	header('Content-Type: application/json');

	$todo_id=$_POST["todo_id"];
	$pdo=new PDO($dbhost,$dbuser, $dbpass);
	$sql="DELETE FROM todo WHERE todo_id=:todo_id";
	$stmt = $pdo->prepare($sql);
	$stmt->execute(array(
		':todo_id' => $todo_id,
	));
	unset($_POST);
	header("Location: ./todo.php#divider");
}
?>
