EntropySink

Technical & Scientific => Programming => Topic started by: Mike on May 20, 2005, 12:43:41 PM

Title: Passing multi dimensional arrays in a form
Post by: Mike on May 20, 2005, 12:43:41 PM
God I wish I had known about this before.

You can pass multi dimensional arrays through html forms.

Its quite simple:
in the name field you simply add [name] after the name.  You can choose not to name the dimension which will then just add it to the end of the array.

example:
Code: [Select]



Why didn't you fuckers tell me about this before!
Title: Passing multi dimensional arrays in a form
Post by: ober on May 20, 2005, 12:58:28 PM
Interesting... I didn't know that either, not that I've ever had a need for it.
Title: Passing multi dimensional arrays in a form
Post by: hans on May 20, 2005, 01:20:34 PM
I'm not seeing the need for that (I don't think I've ever had to do it). What's an example?
Title: Passing multi dimensional arrays in a form
Post by: Mike on May 20, 2005, 01:30:23 PM
Well passing a single dimensional array is useful when you have a group of checkboxes.

For an example of a multidimensional array:
I'm fiddling with making a recipe database and page interface to store recipes for my mom.

So lets look at the ingridents in a recipe:
Each ingrident will have a name, a quantity, and a unit of measure
So I can put them all in the ing array with each element being an array of the name, quant, and uom.