Sharp Tutorial
cookies in php

Python

Java

C

C++

HTML/CSS

Java Script

PHP

SQL

C Programs

PHP Introduction

  • PHP home
  • PHP introduction
  • How to install and run
  • Syntax and Rule in PHP
  • Data type and operator
  • If else in php
  • Loop in php
  • Array in php
  • Sring in php
  • Function in php
  • Include in php

Working with Forms

  • Get and Post
  • Get Form input into PHP
  • Form Validation

PHP with MySQl

  • Connect PHP & Mysql
  • Insert using PHP Mysql
  • Select using PHP MySql
  • Delete Update using PHP Mysql
  • Login Page Example in PHP

Advanced PHP

  • Session in PHP
  • Cookies in PHP
  • File Handling in PHP
  • File Upload/Download PH

Object Oriented PHP

  • Class Obejct in PHP
  • Constructor in PHP
  • Destructor in PHP
  • Inheritance in PHP

cookies in php

Cookie is used to store the local information of the user to give the local information very fast. After the given time cookie values are expired as in given example we give 2 minute time ie 120 seconds.

How to Set the Cookie variable

<?php
  setcookie("country","india",time() + (120), "/");
setcookie("capital","Delhi",time() + (120), "/");
?>
// Here in first cookie country is cookie name , india cookie value
// and 120 is time in seconds to accesss the cookie

 

How to Get the Cookie value.

<?php
 echo"Cookie value= ".$_COOKIE['country']; // get the country cookie value.
echo"<br>Cookie Value= ".$_COOKIE['capital']; // get the capital cookie value.
?>

output of the above program is as following.

Enquiry about Course

Ask your Question

Click Here

Sharp (2) Tutorials

Video/ C Introduction

Watch video in full size

Video tutorial

Follow by Email
Facebook
Facebook
fb-share-icon
YouTube
Copyright © Sharp Tutorial
Build with WordPress
Wordpress Social Share Plugin powered by Ultimatelysocial
Sharp Tutorial