PHP PART- 5 CODE ?



PHP PART- 5 CODE 


  • index.php
    • <?php

    • $cookie_name ='abc';
    • $cookie_value = 'hello';
    • setcookie($cookie_name, $cookie_value, time() + 12, '/');
    • setcookie($cookie_name, $cookie_value, time() - 12, '/');

    • if(isset($_COOKIE[$cookie_name])){
    • echo 'cookie is created';
    • }
    • else{
    • echo 'cookie is not created';

    • }

    • ?>
  • fetch_cookie.php
    • <?php

    • echo 'Your cookie value -: '.$_COOKIE['abc'];

    • ?>

No comments