Easy Cookie Question

Discussion in 'PHP' started by Weirfire, Jun 2, 2006.

  1. #1
    Its always the simplest problems that drive you crazy.

    Can someone tell me how to set a cookie to a value in a variable.

    e.g.

    $fruit = "apples";

    setcookie($fruit, 1, time()+3600);

    should in my opinion set

    $_COOKIE['apples'] to 1 but it doesn't

    Can anyone relieve my insanity? :)
     
    Weirfire, Jun 2, 2006 IP
  2. Weirfire

    Weirfire Language Translation Company

    Messages:
    6,979
    Likes Received:
    365
    Best Answers:
    0
    Trophy Points:
    280
    #2
    I am actually stupid today!

    I had a space in one of the variables e.g. $fruit = "bana nas";
     
    Weirfire, Jun 2, 2006 IP
  3. drewbe121212

    drewbe121212 Well-Known Member

    Messages:
    733
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    125
    #3
    Try to take breaks between coding; trust me; it helps! :)
     
    drewbe121212, Jun 2, 2006 IP
  4. Weirfire

    Weirfire Language Translation Company

    Messages:
    6,979
    Likes Received:
    365
    Best Answers:
    0
    Trophy Points:
    280
    #4
    Completely agree with you drew. Its the long hours thats killing me. We're going to be raising the rates shortly and taking less work and in theory we'll be actually able to get more done through spending better quality time on each job.
     
    Weirfire, Jun 5, 2006 IP