title: How to store items in COOKIES array?
body: <p>I am trying to save the ids of designers the user recently viewed in a <code>cakephp</code> app. My action <code>view()</code> is similar to below:</p>
  
  <pre><code>$this-&gt;Cookie-&gt;write('designers', $id);
  $cookies = $this-&gt;Cookie-&gt;read('designers'); 
  $this-&gt;set("designer_id", $cookies);
  </code></pre>
  
  <p>And the <code>view.ctp</code> is</p>
  
  <pre><code>&lt;h2&gt;COOKIE&lt;/h2&gt;
  &lt;p&gt;Designer ID from cookie: 
      &lt;?php
          echo $designer_id;
      ?&gt;
  &lt;/p&gt;
  </code></pre>
  
  <p>And is displaying the <code>id</code> of the designers I have checked. Now how do I save the ids of the designers I have checked into the cookie ? I have tried as below:</p>
  
  <pre><code>$myarray = array();
  $myarray[] = $id;
  $this-&gt;Cookie-&gt;write('designers', $myarray);
  </code></pre>
  
  <p>But the array contains only the <code>id</code> I am currently viewing ! </p>