Hi. I am relatively new to PHP.
I'm trying to make a user authentication, and sending the user to another page if succeeded, with the following code:
<?php
include ('../conexion.php');
$nombreUsuario = $_POST['nombreusuario'];
$password = $_POST['password'];
var_dump($nombreUsuario);
var_dump($password);
$consultaAdmin= "SELECT * FROM usuarios WHERE nombre_usuario = '$nombreUsuario' AND password = '$password' AND tipo = 'admin'";
$resultadoAdmin = mysqli_query($conn , $consultaAdmin);
$cantidad= mysqli_num_rows($resultadoAdmin);
if($cantidad==1) {
header("location:listado_recetas.php?bienvenida=si");
}else {
header("location:index.php?error=si");
}
?>
I am getting this error:
string( "brsastre" string(10) "igor123123"
Warning: Cannot modify header information - headers already sent by (output started at /Applications/MAMP/htdocs/recetario/admin/validar.php:7)...
If I remove var_dump's it works just fine.
Why is this happening?