Posted by "Ross" on 09/15/05 12:13
I am very close to getting this sorted.....Thanks for all the help on
'variable variables' and var_dump. Two useful techniques.
My function works but throws up a cookie problem
if (isset($add)){
${$add} = intval($_COOKIE['cookie'][$add]);
$new= $$add+1;
setcookie("cookie[$add]", "$new $add");
echo var_dump($_COOKIE['cookie'][$add]);
}
At the beginining of my page I have...
session_start();
require_once('init_cookies.php');
Init_cookies is jus a for loop to initialise the cookies...
$dishes= array ("pakora", "haggis_fritter");
for ($i=0; $i < 2; $i++){
setcookie("cookie[$dishes[$i]]", "0 $dishes[$i]");
when I leave it in it resets the cookies when they are sent to the page.
When I take it out the headers already sent error occurs. I do not know if
this is my lack of undertanding of require_once/include_once.
I need a way to initialise the cookies one time only. I have tried an 'if
(isset)' but that doesn't work.
thanks again....
Ross
Navigation:
[Reply to this message]
|