Posted by Bart on 05/14/06 23:44
Hello,
I created a php script in which I call php fumcion which looks like
this
function confirm($vl) {
?>
<head>
<script type='text/javascript'>
<!--
document.cookie = "qrv=''";
alert(document.cookie);
var answer = confirm("ARE YOU SURE?")
if (answer){
alert('ok');
document.cookie = "qrv=yes";
alert(document.cookie);
}
else{
alert('no');
document.cookie = "qrv=no";
alert(document.cookie);
}
//-->
</script>
</head>
<?
}
Later after I call the above function I want to check what is the
session value
echo $_COOKIE["qrv"];
it is null, but the actual cookie in the browser is set to yes or no.
When I try again the echo command give me the right output.
Problem is that I always have to refresh the webpage in order to get
the cookie value.
It looks like php reads the cookie that was set before you load the
browser page.
Any ideas how to fix that?
Thank You
Bartosz Wegrzyn
[Back to original message]
|