0
Here’s what I’m trying to do:
Every time he click on the button, the counter counts + 1, and this amount will be used in foreach for him to save in cookies.
look at 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);
}
}
Doesn’t explain what problem you’re having
– Jorge Costa
look here the problem, I want to do what I explained but it is showing error, this error here Warning: Invalid argument supplied for foreach()
– Coisas Coisando
In the future put the mistakes you are getting to facilitate the work of those who are helping you, put the error in your question by editing it,.
– Jorge Costa