mardi 4 août 2015

POST a series of products in Laravel / PHP

I'm using Laravel to post a series of products. The user can choose a quantity of each product.

Now I'm wondering how I can post a series, but still have the names of the products.

I have tried the following.

This result gives me an undefined offset error

<input name="{{ $products[$product->id] }}" />

This result doesn't include the name, but does make it a series

<input name="products[]" />

Any idea how I might end up with an array that's called $products, and has all the products in there by name

Aucun commentaire:

Enregistrer un commentaire