#1
  1. No Profile Picture
    Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2000
    Location
    Hong Kong
    Posts
    71
    Rep Power
    15
    Why I can't set and get the Cookies at the same time?

    <?
    $a="123";
    setcookie("abc",$a,time()+86400);

    $b=$HTTP_COOKIE_VARS["abc"];
    echo $b;
    ?>
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2000
    Posts
    63
    Rep Power
    15
    You can't read a cookie until it is submitted from the client.

    Also, all cookies are converted to variables when submitted. So your abc variable can be accessed like so...

    $a = $abc;
  4. #3
  5. No Profile Picture
    Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2000
    Location
    Hong Kong
    Posts
    71
    Rep Power
    15
    I know it.
    Thank you!

IMN logo majestic logo threadwatch logo seochat tools logo