> > I'm trying to set a cookie and have it returned to the 
> script before 
> > the user has to visit another page.
> >
> > I'm currently doing it like this:
> >
> > Original Cookie already set
> > User request -> Script returns Set-cookie and Refresh to 
> second script 
> > Second script called with original cookie, not new one User 
> Request -> 
> > New cookie used
> >
> > I want the second script to be called with the new cookie. 
> I've also 
> > tried
> > this:
> >
> > Original Cookie already set
> > User request -> Script returns Set-cookie and Refresh to refresh 
> > script Refresh script returns refresh to Second script 
> Second script 
> > called with original cookie, not new one User Request -> New cookie 
> > sent
> >
> > Shouldn't the browser create a new http request and send 
> the current 
> > cookies when performing a refresh?
> >
> > Any light on the matter appreciated.
> >
> > Thanks
> > Nigel

I agree, the less cookies the better, but if you must, you can set a cookie then grab 
it in the same script.

Have a look at search.cpan.org
Search for Module 
CGI::Cookie

Use CGI qw/:standard/;
use CGI::Cookie;

..make cookie object see cpan for details
$cookie =....

print header(-cookie=>$cookie); # or something closde to that, see the cpan page for 
specifics

print "HI the cookies you tossed were :";

        %cookies = fetch CGI::Cookie;
        foreach (keys %cookies) {
           print $cookies{$_};
        }
See same script, less filling

Or you could get them and print a redirect to another script if you must but it seems 
a bit like underwear,pants,underwear
But to each his own.

> 
> What are you using the cookies for?  There are usually better 
> ways, that require much less reliance on the internals of the 
> browser, and incur much less visitor resentment/contempt.  
> The simplest, in my view, is to simply insert a hidden field 
> into the form that recalls the script.  One that I often use 
> is: <input type=hidden name="Stage" value="Initiation"> and 
> of course, you would add others at any given stage for the 
> information relevant to the stage of the process involved.  
> The advantage is that form fields are very standard HTML, and 
> do not screw with the user's file system.  This makes them 
> much more welcome.
> 
> Joseph
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to