|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
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
|
|||
|
|||
|
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. |
|
#3
|
|||
|
|||
|
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 |
|
#4
|
|||
|
|||
|
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 |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Perl Programming > CGI.pm problem changing the value of a cookie... |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|