I have a script like this:
<!-- Business Logic Layer -->
<?
...
if ($something)
setcookie("abc", "YES", time()+3600);
else
setcookie("abc", "NO", time()+3600);
...
?>
<!-- Presentation Layer -->
...
...
<?
if ($HTTP_COOKIE_VARS["abc"] == "YES")
print "do something";
?>
....
....
Is my program logic wrong ? I asked because I couldn't get the cookie value at the presentation layer when it first load. It only gets the cookie value after I've reloaded the page. Can I set a cookie and get its value in a same session ? Like the above program. Please advise.
Thank you!