Page 1 of 1

cookie setting

Posted: Wed Apr 20, 2005 4:46 am
by shiznatix
at the top of my script i have

Code: Select all

if (isset ($_POST['remember'])){
setcookie ('name', $name, time()+60*60*24*30, '/', '', 0);
}
then at the bottom of my script i have

Code: Select all

if (isset($_COOKIE['name'])){
$message = $message.'*,*:!.-'.$_COOKIE['name'].'*,*:!.-'.$ip.'*,*:!.-'.$num;
}else{
$message = $message.'*,*:!.-NULL*,*:!.-'.$ip.'*,*:!.-'.$num;
}
but the cookie dosnt seam to get set until the script is completly finished so it takes it 2 runs for it to work. is there any way i can have the cookie set before the script reaches the end??

Posted: Wed Apr 20, 2005 5:08 am
by n00b Saibot
If you have read up on cookie, you would have known that the cookie you set in the first part/top of script wouldn't show up until the next response from the client where it would get set on the next response. So mind that.