|
Posted by John Hinton on 03/27/05 21:11
OK, I created this most simplistic script..
---- Begin Script-------------------------------------------
<?php
if(isset($value))
{
setcookie("mycookie",$value);
}
define (Login, 0);
define (DataReturn, 1);
function login() {
echo "<form ACTION=\"$_SERVER[PHP_SELF]?action=1\" METHOD=\"post\"
ENCTYPE=\"multipart/form-data\">";
echo "Type value: <input name=\"value\" type=\"text\">";
echo "<input name=\"submit\" type=\"submit\">";
echo "</form>";
}
function datareturn(){
print_r($_COOKIE);
echo " is the \$_COOKIE data";
}
if (empty ($action))
$action = 0;
switch ($action) {
case Login:
login();
break;
case DataReturn:
datareturn();
break;
default:
die ("Unknown action code ($action)");
}
?>
----End Script------------------------
I would expect the return on action=1 to report the set cookie, but
instead, it has no data. If I then reload the browser, the cookie
appears. How can I get the cookie to set without this reload? What am I
missing?
Thanks a bunch...
John Hinton
Navigation:
[Reply to this message]
|