SitePoint Sponsor |
|
User Tag List
Results 1 to 2 of 2
Thread: form with multiple data
Hybrid View
-
May 6, 2009, 16:20 #1
- Join Date
- Jan 2003
- Location
- Munich, Germany
- Posts
- 1,391
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
form with multiple data
in a database products with various attributes are stored, eg
jersey in sizes Small, Medium, Large XLarge
wallet in Black, Blue, Red, Yellow
etc.
when displaying a product those attributes will be shown + a field for entering the desired quantity for purchasing it:
Code:Jersey Size | Qty Small | [0] Medium | [0] Large | [0] XLarge | [0]
Code:Wallet Color | Qty Black | [0] Blue | [0] Red | [0] Yellow | [0]
Now if a user buys 2 Jerseys in Medium, ie types a 2 into the quantity input field of Medium and presses 'submit',
how do i know that the quantity of 2 refers to the medium jersey?We are the Borg. Resistance is futile. Prepare to be assimilated.
I'm Pentium of Borg.Division is futile.Prepare to be approximated.
-
May 6, 2009, 16:42 #2
- Join Date
- Jul 2008
- Posts
- 5,757
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
http://www.php.net/manual/en/faq.htm...aq.html.arrays
Code:<input name="items[Jersey][Small]"> <input name="items[Jersey][Medium]"> <input name="items[Wallet][Black]"> <input name="items[Wallet][Blue]">
PHP Code:print_r($_POST['items']);
Code:<input name="items[123]"> <input name="items[124]"> <input name="items[555]"> <input name="items[556]">
Bookmarks