Having this Entity for example:
<?php
namespace Gitek\HotelBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Gitek\HotelBundle\Entity\Product
*
* @ORM\Table()
* @ORM\Entity(repositoryClass="Gitek\HotelBundle\Entity\ProductRepository")
*/
class Product
{
/**
* @var integer $id
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string $name
*
* @ORM\Column(name="name", type="string", length=100)
*/
private $name;
How to build a Form to save like 10 products on a row? I want a form with a “+” button and dinamically add line and submit all products in a row.
any help or clue?
thanks in advance
You could use Javascript(jQuery) to add the form elements to your page dynamically when you click the “Add” button. Something like this:
Reference
Then when the form is posted, you can walk through the
$_POSTarray.