php - same name for multiple inputs -


I have a form ... where I have to use the same name as the field for each product on the form.

No part, item and price, if I want to add many items with an order button, then it can not be different. The example code below works with Cart32's shopping cart software to add many items to the cart. I would like to know how many items they use, such as parts, and are capable of achieving all the values ​​of that area.

I tried to write my page to get input and could not get many items for my life, repeat areas like parts, quantity and value I have $ _REQUEST, $ _POST and $ _GET has tried and I get only the last value, so this is not a case.

Here is an empty example

, E.g.

  & lt; Input type = "text" name = "field []" value = "first" / & gt; & Lt; Input type = "text" name = "field []" value = "second" /> & Lt; Input type = "text" name = "field []" value = "third" />   

will produce the following $ _POST structure:

  $ _ POST = array ('field' = & gt; array (0 = & gt; First ', 1 = & gt;' second ', 2 = & gt;' third ',));   

The option is to add incremental numbers to each field name, because you duplicate existing field sets for each new block. It provides a nice separation between the block and guarantees that the corresponding field has a same numeric tag, but it complicates the resource.



Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -