I have a form that is a little complex and I am hoping to simplify the server-side (PHP) processing by natively POSTing an array of tuples.
The first part of the form represents a User:
- First Name
- Last Name
- Address
- etc
The second part of the form represents a Tree:
- Fruit
- Height
- etc
The problem is that I need to be able to POST multiple Trees for a single User in the same form. I would like to send the information as a single User with an array of Trees but this might be too complex to do with a form. The only thing that comes to mind is using javascript to create some JSON message with a User object and an array of Tree objects. But it would be nice to avoid javascript to support more users (some people have scripts turned off).
check this one out.
it should end up like this in the $_POST[] array (PHP format for easy visualization)
You can also post multiple inputs with the same name and have them save into an array by adding empty square brackets to the input name like this:
If you use php:
you will get this: