title: Incremented $_COOKIE[array] not working?
body: <p>I am using a <code>$_COOKIE[array]</code> in order to save data for a single input. This input will only submit if the user entered the same value twice. For instance, if they submitted apple, then orange, then banana, then apple, the form would submit on the second appearance of "apple".</p>
  
  <p>I read [this tutorial](
  <a href="http://phpprogramming.wordpress.com/2007/03/06/php-cookies-tutorial-and-examples/" rel="nofollow">http://phpprogramming.wordpress.com/2007/03/06/php-cookies-tutorial-and-examples/</a>).</p>
  
  <pre><code>for ($i = 1; $i &lt; 10; $i++) {
      if (!isset($_COOKIE[$i])) {
          setcookie("query" . [$i],$query,time()+604800,"/");
          break1;
      }
  }
  foreach ($_COOKIE["query"] as $key =&gt; $value) {
      echo "$key:$value";
  }
  </code></pre>
  
  <p>I believe it might be a syntax error since I get:</p>
  
  <pre><code>Warning: Invalid argument supplied for foreach()
  </code></pre>
  
  <p>If you know a better way (can't be mySQL), then please let me know!</p>