Reply to cookies problem

Your name:

Reply:


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

[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

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