The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Programming Languages
> Perl Programming
|
CGI.pm problem changing the value of a cookie...
Discuss CGI.pm problem changing the value of a cookie... in the Perl Programming forum on Dev Shed. CGI.pm problem changing the value of a cookie... Perl Programming forum discussing coding in Perl, utilizing Perl modules, and other Perl-related topics. Perl, the Practical Extraction and Reporting Language, is the choice for many for parsing textual information.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

August 14th, 2000, 02:26 PM
|
|
Contributing User
|
|
Join Date: Aug 2000
Location: Los Gatos, CA
Posts: 42
Time spent in forums: 56 m 57 sec
Reputation Power: 13
|
|
|
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
|

August 14th, 2000, 03:43 PM
|
|
Junior Member
|
|
Join Date: Jun 2000
Posts: 12
Time spent in forums: < 1 sec
Reputation 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.
|

August 15th, 2000, 05:33 AM
|
|
Junior Member
|
|
Join Date: Aug 2000
Location: Saigon,Vietnam
Posts: 1
Time spent in forums: < 1 sec
Reputation 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
|

August 15th, 2000, 05:21 PM
|
|
Contributing User
|
|
Join Date: Aug 2000
Location: Los Gatos, CA
Posts: 42
Time spent in forums: 56 m 57 sec
Reputation Power: 13
|
|
|
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
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|