Currently I have two table Products and Orders joined with HABTM. I would like to add the order by ticking product on the list. Below is the code in OrdersController
$products = $this->Order->Product->find('all');
$this->set(compact('products'));
Here is the code in orders/add.ctp
<?php
foreach ($products as $product)
{
echo "<tr>";
echo "<td class='heading'>".$product['Product']['name']."</td>";
echo "<td>". $product['Product']['price']."</td>";
echo "<td class='data'>";
echo $this->Form->input("Product.checkbox.$product", array('label'=>'','legend'=>false,'type'=>'checkbox'));
echo "</td>";
echo "</tr>";
}
?>
It display product information and checkbox. When I submit the order, it is not saved into ordersproducts table. Any help would be greatly appreciated.