I'm trying to do the following: Each time he clicks the button, the counter counts + 1, and this amount will be used in the foreach for it to save in cookies. see my code:
$contar = 0;
if(isset($_POST['submit'])){
$contar = $contar + 1;
}
if (isset($_POST['ideia'])) {
$cookie_value= $_POST['ideia'];
foreach ($contar as $id) {
setcookie('text['.$id.']',$cookie_value,time()+36000);
}
}