Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get cookie value

Tags:

Creating cookie

session_start(); $params = session_get_cookie_params();     setcookie(session_name('USERNAME'),'HAMZA',1,       isset($params['path']),       isset($params['domain']),       isset($params['secure']),       isset($params['httponly']));  session_regenerate_id(true); echo "COOKIE IS CREATED SUCCESSFULLY !"; 

Now fetching cookie value

session_start(); $NAME=$_COOKIE['USERNAME']; echo $_COOKIE["USERNAME"];  if(isset($NAME)) {       if($NAME=='USERNAME')       {           echo "success";       }       else      {           echo "error";             }      } 

Please Help Me !

Result

Why they create Auto random Value Like: u8omuum6c9pkngrg4843b3q9m3). But i want to get my Original COOKIE value Which is "HAMZA" ?????