-2
Well, I have the following code to decide my cookies and use another page, so when I make $_COOKIE[$cookie_email] on the other page where I want to use the value saved gives me whenever this value is null. even if '/' does not work
$nomenecessario=$_GET['ref'];
$count=$_POST['nivelacessos'];
if ($conn->query("UPDATE subditos SET niveis_acesso_id='$count' WHERE
id='$nomenecessario'") === TRUE){
//Buscar na tabela usuario o usuário que corresponde com os dados digitado
no formulário
$result_usuario = "SELECT * FROM subditos WHERE id='$nomenecessario'
LIMIT 1";
$resultado_usuario = mysqli_query($conn, $result_usuario);
$resultado = mysqli_fetch_assoc($resultado_usuario);
//Encontrado um usuario na tabela usuário com os mesmos dados digitado no formulário
if(isset($resultado)){
$cookie_email = $resultado['email'];
setcookie($cookie_email, time() + (86400 * 30)); // 86400 = 1 day
$_SESSION['usuarioId'] = $nomenecessario;
$_SESSION['usuarioNiveisAcessoId'] = $resultado['niveis_acesso_id'];
$_SESSION['usuarioEmail']=$resultado['email'];
$_SESSION['usuarioSenha']=$resultado['senha'];
if($_SESSION['usuarioNiveisAcessoId'] == "1"){
echo $cookie_email;
$rer=0;
echo "<script>irpaginafronta()</script>";
}else{
$rer=1;
echo "<script>irpaginah()</script>";
}
}
}
setcookie($cookie_email, time() + (86400 * 30)), "/"); If we specify "/" the cookie will be valid within the entire domain.
– user60252
has already been answered here https://answall.com/questions/152224/problemas-para-displayingcookies
– user60252
Possible duplicate of Problems to display cookies
– user60252
none of your answers were helpful as even if '/' does not work
– Music Lyrics HQ
You can inform if observed the Developer Tools the cookie has actually been saved?
– Lauro Moraes
in your case the "do_cookie name" was missing, see reply
– user60252