I have the code below at the beginning of a page. I'm going for it without passing ID by GET, so it's entering ELSE correctly. It is passing through the setFlash, but does not redirect the page through the location. It stays on the same page. What can it be?
<?php
if(!empty($_GET['id'])){
$id = $_GET['id'];
$estabelecimentoDao = new EstabelecimentoDAO();
$estabelecimentos = $estabelecimentoDao->all();
$agendaDao = new AgendaDAO();
$teste = $agendaDao->first($id);
}else{
$flash = new Flash();
$flash->setFlash('Para editar você precisa passar um ID Válido</br>', 'alert-danger');
header('Location:../../View/Agenda/index.php');
}
?>