require_once 'Connection.class.php'; require_once 'GroupDAO.class.php'; $action = isset($_GET['action']) ? $_GET['action'] : 'new'; $id = isset($_GET['id']) ? $_GET['id'] : -1; if ($action !== 'update' && $action !== 'new') { die('opció invalida'); exit; } if ($action === 'update') { /*if ($id <= 0) { die 'if no valid'; exit; }*/ $c = new Connection(); $conn = $c->getConnection(); $GroupDAO = new GroupDAO($conn); $group = $GroupDAO->select($id); } else { $group = array('id' => -1, 'name' => '', 'age' => '', 'date_start' => '', 'date_end' => '', 'location' => '', 'observations' => '', 'comments' => ''); } $title = $action === 'new' ? 'Nou grup' : 'Modificar grup'; include 'head.php'; ?> <br> <div class="row"> <h1 class="text-center"><?php echo $title; ?> </h1>