break; case 'editdream': // Include database connection $db = new PDO(DB_INFO, DB_USER, DB_PASS); $dreams = new Dreams($db); if (isset($_GET['action'])) { $d = $dreams->getDream(NULL, $_GET['dream']); include_once 'views/editDream.php'; break; } else { if ($_POST['submit'] == "Cancel") { // Check if the user clicked cancel, if so don't submit header('location: ' . $loc); exit; } $dreams->addDream($_POST); header('location: /get-lucid/dreams/' . $url); } case 'dreams': // Include database connection $db = new PDO(DB_INFO, DB_USER, DB_PASS); $dreams = new Dreams($db); $comments = new Comments($db); if ($url == NULL) { $d = $dreams->getDreams(); include_once 'views/list.php'; } else { $d = $dreams->getDream($url); $c = $comments->getComments($d['id']); include_once 'views/dream.php'; }