I'm doing a login using the MVC model in PHP and I have a problem of
Warning: session_start (): Can not send session cache limiter - headers already sent (output started at C: \ xampp \ htdocs \ backEndEmisoraSanJoseObrero \ views \ modules \ navegacion.php: 1) in C: \ xampp \ htdocs \ backEndEmisoraSanJoseObrero \ controllers \ controller.php on line 43
and
Warning: Can not modify header information - headers already sent by (output started at C: \ xampp \ htdocs \ backEndEmisoraSanJoseObrero \ views \ modules \ navegacion.php: 1) in C: \ xampp \ htdocs \ backEndEmisoraSanJoseObrero \ controllers \ controller .php on line 42 **
When wanting to work with the sessions
The Form is this:
<center>
<div class="admin">
<h1 class="ingresoTitle">Inicio de Sesion del Administrador</h1>
<form method="post">
<input type="text" placeholder="Usuario" name="usuarioIngreso">
<input type="password" placeholder="Contraseña" name="passwordIngreso">
<input type="submit" value="Enviar">
</form>
</div>
</center>
<?php
$ingreso = new MvcController(); //Creamos un nuevo objeto
$ingreso -> inicioSesionController(); //llamamos la funcion
?>
And the PHP code that handles the form this:
public function inicioSesionController(){
if (isset($_POST['usuarioIngreso'])) {
if ($_POST['usuarioIngreso'] == 'admin') {
header('location=ok');
session_start();
$_SESSION['user']= true;
}
}
}
}
I have been looking at my code for days, changing and testing and I can not find the problem.
To enter the form, use a GET link that is ?action=admin
The full code on GitHub: link
The weird thing is that this login uses the same technique and does not throw error link