Perl Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPerl Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old August 14th, 2000, 02:26 PM
chovy chovy is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2000
Location: Los Gatos, CA
Posts: 42 chovy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 56 m 57 sec
Reputation Power: 13
Send a message via Yahoo to chovy
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

Reply With Quote
  #2  
Old August 14th, 2000, 03:43 PM
Obsidian11 Obsidian11 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Posts: 12 Obsidian11 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to Obsidian11
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.

Reply With Quote
  #3  
Old August 15th, 2000, 05:33 AM
htruong htruong is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2000
Location: Saigon,Vietnam
Posts: 1 htruong User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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

Reply With Quote
  #4  
Old August 15th, 2000, 05:21 PM
chovy chovy is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2000
Location: Los Gatos, CA
Posts: 42 chovy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 56 m 57 sec
Reputation Power: 13
Send a message via Yahoo to chovy
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

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > CGI.pm problem changing the value of a cookie...

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap