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

    Join Date
    Aug 2000
    Location
    Los Gatos, CA
    Posts
    42
    Rep Power
    15
    I am using CGI.pm, at the top of the script I set a cookie with survey=false.

    This keeps track of whether the person has completed the form.

    I then validate the form, if there is an unanswered question, I send them back to the form.

    If the form IS valid, I want to change the value of the cookie I set to survey=true.

    It seems I can only set one or more cookies at one point in the script. How do I change the value of a cookie that has already been set??

    Thanks!
    Chovy



    ------------------
    --
    chovy
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    12
    Rep Power
    0
    Hello,

    As far as I know..... You can only send a cookie once each time the client downloads your page, and it needs to be in the header, so... you should be able to make an if/else statement that checks to see if the form was validated, and if it was it sends survey=true, else it sends survey=false.

    But it should only do one or the other.
    Does that help?

    If anybody sees a point that I'm wrong on please correct me.
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Saigon,Vietnam
    Posts
    1
    Rep Power
    0
    Hello,
    You should let your cookie variable expire (just create expires's date before created day that you set for survey) then create a new cookie which the same name and new value (that you want to set) :-)
    For Example:
    SetCookie (survey,'false','December 1, 1900 24:00:00',/your_document_path,your_domain_name,null);
    SetCookie (survey,'true','December 1, 2005 00:00:00',/your_document_path,your_domain_name,null);

    see SetCookie () function in the document of JavaScript user Guide or Perl Complete user Guide.



    ------------------
    htruong
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Los Gatos, CA
    Posts
    42
    Rep Power
    15
    Thanks!

    I tested for the cookie (if set to yes, then exit, cause they can only fill out survey once, then if false or non-existent, I went thru and validated form, then if form valid, set the cookie.

    i had to remove the print statements that were in the loop validating the form. These were mainly for my own test purposes, ie- print "answer $answ is valid" etc...so it wasn't a problem.

    Thanks for the responses!

    ------------------
    --
    chovy

IMN logo majestic logo threadwatch logo seochat tools logo