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

    Join Date
    Mar 2000
    Posts
    60
    Rep Power
    15
    Howdy all,

    I am trying to figure out how to trim number of cookies.
    My code presently sets 3-4 different cookies, based on the type of user, so they are set normally

    setcookie ("cookie_name1", "$cookie_name1",time()3600);
    setcookie ("cookie_name2", "$cookie_name1",time()3600);
    setcookie ("cookie_name3", "$cookie_name1",time()3600);
    (don't take this code to seriously, just an illustration)

    How can I trim these into a single setcookie
    setting all the variables in a single string?

    Any ideas?
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2000
    Posts
    63
    Rep Power
    15
    Just set the cookie with the values delimited (usually by comma) and then when the cookie is submitted, just explode the cookies value into an array....

    setcookie ("mycookie","ulysses, joe, jim",time()+3600);

    $L_mycookie_array = explode(",",$mycookie);

    $myvar1 = $L_mycookie_array[0];
    $myvar2 = $L_mycookie_array[1];
    $myvar3 = $L_mycookie_array[2];

Similar Threads

  1. is number a prime number program
    By easy in forum Java Help
    Replies: 2
    Last Post: January 30th, 2004, 04:36 PM
  2. Replies: 23
    Last Post: January 2nd, 2004, 10:28 AM
  3. cant delete cookies random errors
    By toxical in forum PHP Development
    Replies: 2
    Last Post: November 26th, 2003, 06:16 AM
  4. Replies: 1
    Last Post: November 22nd, 2003, 04:02 PM
  5. Clearing all cookies php script - HowTo?
    By fordfasterr in forum PHP Development
    Replies: 8
    Last Post: October 24th, 2003, 10:40 AM

IMN logo majestic logo threadwatch logo seochat tools logo