Set Cookies Get Cookies Delete Cookies with PHP
In this Post We Will Explain About is Set Cookies Get Cookies Delete Cookies with PHP With Example and Demo.Welcome on Pakainfo.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to Set Cookies Get Cookies Delete Cookies with PHPExample
In this post we will show you Best way to implement How to Set, Get and Delete Cookies in PHP, hear for Set, get and delete data from cookie in PHPwith Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.
Uses of cookies
There are the following the list of Uses of Cookies
Store user simple preferences (Like as a color and font size and HTML element size and theme etc.)
Track simple progress (Like as a page number and percentage, etc.)
Store simple username or any numbers (to simple identify more user)
Set Cookie using PHP
$cooke_data_val = 'Chrome'; //simple variable setcookie("mycokname", $cooke_data_val, time()+3600); //cookie name, value & time (1 hour) setcookie(NAME, VALUE, EXPIRE, PATH, DOMAIN, SECURE, HTTPONLY) $cooke_data_val = 'Chrome'; //simple variable setcookie("mycokname", $cooke_data_val, time()+3600, '/', 'sanwebe.com', true, true);
Retrieve Cookie Value using PHP
echo 'Pakainfo.com - Your mycokname is ' . $_COOKIE['mycokname']; if(isset($_COOKIE['mycokname'])) //check cookie exist { echo 'Your mycokname is ' . $_COOKIE['mycokname']; } $cookie_value = (isset($_COOKIE['mycokname']))? $_COOKIE['mycokname'] :'no cookie'; echo $cookie_value ;
Delete a Cookie using PHP
setcookie("mycokname", "", time()-3600); //expiration simple time set to latest one hour ago
I hope you have Got What is How to Create, Read, Update and Delete a Cookie with PHP And how it works.I would Like to have FeadBack From My Blog(Pakainfo.com) readers.Your Valuable FeadBack,Any Question,or any Comments abaout This Article(Pakainfo.com) Are Most Always Welcome.