0
I have the code below right at the top of a page. I am going to it without passing ID through GET, so you are entering ELSE correctly. It is going through setFlash, but does not redirect the page through Location. It stays on the same page. What can 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');
}
?>
this code is by inserting on a larger page? I say the header has already been sent? I believe I can only redirect before sending the header
– Danilo
header won’t work if you have any code printed on the screen.
– KillerJack
That was it. Thank you :D
– Rodrigo Segatto