Recent Posts

This Post Has Been Viewed 143 Times.

Simple Code To Set And Retrieve Cookie Using PHP

Posted by admin | Posted in PHP, scripts | Posted on 23-05-2009

0

Setting a cookie using PHP

<?php
$expire=time()+60*60*24*30;
setcookie(”user”,”Balu”, $expire);
?>

<html></html>

Retrieve a cookie using php

<html>
<body>

<?php
if (isset($_COOKIE["user"]))
echo “Welcome ” . $_COOKIE["user"] . “!<br />”;
else
echo “Welcome guest!<br />”;
?>

</body>
</html>

Very simple is it….enjoy!!!!!!!!!!!!!!

VN:F [1.5.7_846]
Rating: 0.0/10 (0 votes cast)
VN:F [1.5.7_846]
Rating: 0 (from 0 votes)
Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • De.lirio.us
  • Xerpi

Related posts:

  1. How To Set And Get Cookies Using PHP
  2. Warning: session_start(): Cannot send session cookie headers already sent

Write a comment

Spam Protected