title: Cakephp - saving multiple checkboxes to a join table
body: <p>I need help with saving multiple checkboxes to a join table.</p>
  
  <p>There are 3 tables:</p>
  
  <ul>
  <li><strong>Customers</strong> (id,name, address)</li>
  <li><strong>Products</strong> (id,product_name,desc) all products are entered.</li>
  <li><strong>Customers_Products</strong> (id,product_id,customer_id) &lt;-(join table)</li>
  </ul>
  
  <p><strong>Step 1:</strong><br>
  Customer selects the desired products <em>(apples,oranges,cherries in checkbox)</em>
  and click <code>&lt;Next&gt;</code> button</p>
  
  <p><strong>Step 2:</strong><br>
  Fills out the form about themselves <em>(name, address and etc).</em>
  and click <code>&lt;Submit&gt;</code> button</p>
  
  <p><strong>Step 3:</strong><br>
  I am saving personal info from Step 2 to Customers table and selected products id(s) from Step 1 to Customers_Products table.
  It does save the personal info and product id to designated tables, but when customer selects more than one products, it does not save the products id.
  it adds row but the products id field is empty.</p>
  
  <p>Here is my view:</p>
  
  <ul>
  <li><code>&lt;?php echo $this-&gt;Form-&gt;checkbox('CustomerProduct.product.', array('value' =&gt; '1', 'style' =&gt; 'float: left; display: inline')); ?&gt;</code></li>
  <li><code>&lt;?php echo $this-&gt;Form-&gt;checkbox('CustomerProduct.product.', array('value' =&gt; '2', 'style' =&gt; 'float: left; display: inline')); ?&gt;</code></li>
  <li><code>&lt;?php echo $this-&gt;Form-&gt;checkbox('CustomerProduct.product.', array('value' =&gt; '3', 'style' =&gt; 'float: left; display: inline')); ?&gt;</code></li>
  <li><code>&lt;?php echo $this-&gt;Form-&gt;input('Customers.name', array('value'=&gt;'Jon Toshmatov')); ?&gt;</code></li>
  </ul>
  
  <p>Controller:</p>
  
  <pre><code>$this-&gt;Prospect-&gt;saveAll($this-&gt;request-&gt;data);
  </code></pre>
  
  <p>Model:</p>
  
  <pre><code>public $hasAndBelongsToMany = array(
      'CustomerProduct' =&gt; array(
          'className' =&gt; 'CustomerProduct',
          'joinTable' =&gt; 'customers_products',
          'foreignKey' =&gt; 'customer_id',
          'associationForeignKey' =&gt; 'product_id',
          'unique' =&gt; 'false',
          'dependent' =&gt; false,
          'conditions' =&gt; '',
          'fields' =&gt; '',
          'order' =&gt; '',
          'limit' =&gt; '',
          'offset' =&gt; '',
          'exclusive' =&gt; '',
          'finderQuery' =&gt; '',
          'counterQuery' =&gt; ''
      )
  </code></pre>
  
  <p><strong>Desired result:</strong>
  I want save the data in the following order:</p>
  
  <pre>
  Customers table:
  id     name
  1      Jon T
  
  Customers_Products *(join table)*
  id   product_id   customer_id
  1    4            1
  2    3            1
  3    5            1
  </pre>