The code below does run, but it always returns a message of "No cookie
passed." I've refreshed the page, closed & reopened it & even quit my
browser & reaccessed. I never get any message but "No cookie passed"

I can look in the cookie list in IE's preferences, and the cookie is there.

Frustrated, but thankful for your help,

-John Stokes
Computer Psychiatrist (Director of Information Technology)
Church Resource Ministries
[EMAIL PROTECTED] 

Three pillars: Humility, Communication, Balance

> ----------
> From:         Curtis Poe
> Reply To:     [EMAIL PROTECTED]
> Sent:         Friday, June 1, 2001 3:20 PM
> To:   CGI Beginners
> Subject:      Re: Retrieving cookies
> 
> --- "Stokes, John" <[EMAIL PROTECTED]> wrote:
> > OK, I'm still having a problem.
> > 
> > I still can't seem to manipulate the cookie data. Say I want to record
> > someone's name and then print out "hello so-and-so" when they return to
> my
> > site. (That's not what this is actually for, but it's the same idea.)
> Why
> > doesn't the code below work on the second visit to the page?
> > 
> > It doesn't seem to work in an if() { structure either.
> > 
> > Thanks in advance.
> 
> When I posted the code, I left the domain in there as I assumed you were
> testing it on that
> server.  If you are testing with a different domain, you can't retrieve
> the cookie (this is a
> security measure to ensure that you can't read cookies set by other
> sites).
> 
> Removing the following should work:
> 
>     -domain  => '.biola.edu'
> 
> I successfully ran the following code:
> 
> use strict;
> use CGI;
> my $q = CGI->new;
> 
> my $myCookie = $q->cookie( -name    => 'Fyre',
>                            -value   => 'blah,blah,blah',
>                            -expires => '+3M' );
> my $cookie_value = $q->cookie( 'Fyre' );
> print $q->header( -cookie => $myCookie ),
>         $q->start_html,
>         $q->p( "Test" );
> if ( ! $cookie_value ) {
>       print $q->p( "No cookie passed" );
> } else {
>       print $q->p( $cookie_value );
> }
>       print $q->end_html;
> 
> Since domain is not specified, it should return the value (as it did for
> me).
> 
> When you don't specify the domain, it will default to your domain.
> 
> Cheers,
> Curtis A. Poe
> 
> =====
> Senior Programmer
> Onsite! Technology (http://www.onsitetech.com/)
> "Ovid" on http://www.perlmonks.org/
> 
> __________________________________________________
> Do You Yahoo!?
> Get personalized email addresses from Yahoo! Mail - only $35 
> a year!  http://personal.mail.yahoo.com/
> 
> 

Reply via email to