inestine Posted September 29, 2011 Share Posted September 29, 2011 I have a table that allows users to add rows, depending on how much data they need to insert. upon submit I'd like to populate another table for review. Now I can generate the data, but I'm having trouble putting the array into a table. Here is the output from the initial page: Array ( [quantity] => Array ( [0] => 1 [1] => 2 [2] => 3 ) [description] => Array ( [0] => 1 [1] => 2 [2] => 3 ) [unit_cost] => Array ( [0] => 1 [1] => 2 [2] => 3 ) [shipping] => 4 [tax] => 5 [review_po] => Review ) I need it to look like this: Quantity | Description | Unit Cost 1 | 1 | 1 2 | 2 | 2 3 | 3 | 3 Tax | 4 Ship | 5 I think it's a foreach statement, but I'm not having any luck.. If someone could point me in the right direction??? Link to comment https://forums.phpfreaks.com/topic/248125-populate-html-table-with-array/ Share on other sites More sharing options...
mikesta707 Posted September 29, 2011 Share Posted September 29, 2011 Question: Will the table example you showed always be of those dimensions (IE the quantity and description inner arrays will always have 3 elements) or could the table look different depending on the array (who's size and format may be different every time the script runs)? Link to comment https://forums.phpfreaks.com/topic/248125-populate-html-table-with-array/#findComment-1274121 Share on other sites More sharing options...
inestine Posted September 29, 2011 Author Share Posted September 29, 2011 It could have any number of rows, but the columns will always be the same. Link to comment https://forums.phpfreaks.com/topic/248125-populate-html-table-with-array/#findComment-1274122 Share on other sites More sharing options...
inestine Posted September 30, 2011 Author Share Posted September 30, 2011 anyone??? Link to comment https://forums.phpfreaks.com/topic/248125-populate-html-table-with-array/#findComment-1274308 Share on other sites More sharing options...
inestine Posted September 30, 2011 Author Share Posted September 30, 2011 Does anyone have any ideas how I can get started on this? Link to comment https://forums.phpfreaks.com/topic/248125-populate-html-table-with-array/#findComment-1274463 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.