Cookie does not exist

3

I'm trying to pass some data from one page to another, but it's not working correctly.

  

link

<?php
$nome = "JOSIMAR";
setcookie("nomee", $nome);
echo "<script type='text/javascript'>window.location=' ../demostracao/usuarios/index.php'</script>"; 
?>
  

link

<?php

if(isset($_COOKIE["nomee"]))
{
    echo "Existe";
}else
{
    echo "Nao existe";
} 
?>

It's coming back to me 'does not exist', does anyone give me a light?

    
asked by anonymous 15.09.2016 / 16:13

1 answer

2

Resolved as quoted by my friend @Augusto, but with some necessary modifications like this:

  

index.php

<?php
$nome = "JOSIMAR";
setcookie("nomee", "$nome", time() + 3600, "/");
echo "<script type='text/javascript'>window.location=' ../demostracao/usuarios/index.php'</script>";
?>
  

recib.php

<?php

if(isset($_COOKIE["nomee"]))
{
    echo "Existe";
}else
{
    echo "Nao existe";
}
?>
    
15.09.2016 / 16:25