Code for cookies not working!

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • TG

    Code for cookies not working!

    What is wrong with the following code? I have set allow all cookies on for
    my browser. Why does this always redirect to NoCookies.htm?

    Please see code below (both of the logic constructs below always redirect to
    NoCookies.htm)

    =============== =============== =============== =============== ===

    setcookie ("thisisthename ","Cookie_test" ,time()+86400,"/");

    if (!isset ($cookie)) {
    //echo "We could not find the cookie, it may have expired?";
    Header("locatio n: NoCookies.htm") ; ////// Redirect if all is
    successful!!!
    exit;
    }

    if (!isset($_cooki e['thisisthename']))
    {
    //echo "We could not find the cookie, it may have expired?";
    Header("locatio n: NoCookies.htm") ; ////// Redirect if all is
    successful!!!
    exit;
    }


  • Jon Kraft

    #2
    Re: Code for cookies not working!

    "TG" <tgillette1@cox .net> wrote:
    [color=blue]
    > What is wrong with the following code? I have set allow all cookies on
    > for my browser. Why does this always redirect to NoCookies.htm?
    >
    > Please see code below (both of the logic constructs below always
    > redirect to NoCookies.htm)
    >
    > =============== =============== =============== =============== ===
    >
    > setcookie ("thisisthename ","Cookie_test" ,time()+86400,"/");
    >
    > if (!isset ($cookie)) {[/color]

    Because the above is always true, i.e. $cookie is never set.

    Read the manual:


    HTH;
    JOn

    Comment

    Working...