Why isn't this simple PHP Forloop working?

JHaleZir

New Member
First here's the code:\[code\]<?php$qty = $_GET['qty'];for($i=0; $i < $qty; $i++){ setcookie('animals', $_COOKIE['animals'].'(lion)', time()+3600);}?>\[/code\]Here's what I'm trying to do:I want to set the value of the "animals" cookie to "(lion)". The number of instances of "(lion)" that should be in the cookie is determined by the "qty" GET parameter's value. So for example if the pages url is:\[code\]http://site.com/script.php?qty=10\[/code\]then the value of the cookie should be:\[code\](lion)(lion)(lion)(lion)(lion)(lion)(lion)(lion)(lion)(lion)\[/code\]but now it just sets the value once despite the setcookie function being inside the loop, why isn't it working?
 
Top