Reply to passing javascript cookies into php script

Your name:

Reply:


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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация