Thanks for your help.I found my error. It was that i wasn't setting the cookie value before i made the setcookie.I understood that each time i want to use a cookie i have to call the setcookie function because the cookie exists only after one refresh.
My code looks like :
if(!$mycookie)
$mycookie = $sender[id];
setcookie("mycookie",$mycookie,time()+100000);
And it works in both browsers.