i want to use cookie in web page and i want to use it for save any optional variables. but after use setcookie and refresh page isset()
Cookie is set to a specific path and domain. You should change setcookie() to
setcookie ("user", "Alex Porter", time()+3600, "/", "youdomain.com");
If set to '/', the cookie will be available within the entire domain(youdomain.com).
Cookie will be visible after page refresh.
Your code can be simplifed as well:
echo "Welcome " . isset($_COOKIE["user"]) ? $_COOKIE["user"] : "guest" . "!
";