SPrelewicz
Programmer
I posted this in the CGI forum, but am cross posting here:
I have a shopping cart type-ish of a thing. I want a user to be able to move around the site and add stuff that gets added to a cookie's value. When they go to the "cart", the CGI reads the cookie and slits/parses it up to fillin the "cart". No problem there.
Now, when a user hits submit, I redirect to a page, "thankyou", that has a SSI that runs a CGI that is supposed to destroy the cookie.
Here's that script:
#!/usr/local/bin/perl
#use CGI ':standard';
use CGI;
my $co=new CGI;
$cookie = $co->cookie
(
-name=>'data',
-value=>'',
-path=>'',
-expires=>'Wednesday, 8-Aug-02 23:59:59 GMT',
);
print $co->header(-cookie=>$cookie);
As you can see, I set the date to the past AND the value to null. But after I submit and this page is run, I go to add something else to the "cart" and everything else id still there, IE the cookie has NOT been destroyed. The baffling part is, to debug I printed out the cookie on the thankyou page, and it says the value is null. Ideas?
Thanks
Scott
I have a shopping cart type-ish of a thing. I want a user to be able to move around the site and add stuff that gets added to a cookie's value. When they go to the "cart", the CGI reads the cookie and slits/parses it up to fillin the "cart". No problem there.
Now, when a user hits submit, I redirect to a page, "thankyou", that has a SSI that runs a CGI that is supposed to destroy the cookie.
Here's that script:
#!/usr/local/bin/perl
#use CGI ':standard';
use CGI;
my $co=new CGI;
$cookie = $co->cookie
(
-name=>'data',
-value=>'',
-path=>'',
-expires=>'Wednesday, 8-Aug-02 23:59:59 GMT',
);
print $co->header(-cookie=>$cookie);
As you can see, I set the date to the past AND the value to null. But after I submit and this page is run, I go to add something else to the "cart" and everything else id still there, IE the cookie has NOT been destroyed. The baffling part is, to debug I printed out the cookie on the thankyou page, and it says the value is null. Ideas?
Thanks
Scott