Stupid setcookie() question...
From: Bonge Boo! (bingbong_at_spamcop.net)
Date: 02/21/05
- Next message: CyberDog: "Re: Link protection (reg_globals)"
- Previous message: Henk Verhoeven: "Re: speed"
- Next in thread: CyberDog: "Re: Stupid setcookie() question..."
- Reply: CyberDog: "Re: Stupid setcookie() question..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 21 Feb 2005 21:03:42 +0000
Sorry if this is blazingly obvious.
I have a number of multipage forms and I wish to be able to save "sessions
state" between.
I can happily set them up so that hidden fields get created with the values
of the form fields from the previous pages get created and hence sent to the
next form in the series.
However if some goes from Form4 back to Form1 then I don't want them to have
to fill in all the forms gain.
So cookies I thought.
Havoever Iseem to be having a problem
Lets say I place the following at the top of the page, before any HTML
setcookie('instruction_type', $_POST['instruction_type'], time()+1800);
print "We set the cookie to: " .$_COOKIE['instruction_type'];
All is good. Apart from this.
ITS PRINTING OUT THE VALUE OF THE COOKIE PRIOR TO THE FORM BEING SUBMITTED.
So if the cookie was value was previously "Bob" and I've changed the form
value so it is now "John" then John still gets printed out.
However if I reload the page then "John" gets printed correctly.
So can you only set a COOKIE vale on page, not view it on the same page as
it has been set on?
- Next message: CyberDog: "Re: Link protection (reg_globals)"
- Previous message: Henk Verhoeven: "Re: speed"
- Next in thread: CyberDog: "Re: Stupid setcookie() question..."
- Reply: CyberDog: "Re: Stupid setcookie() question..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|