ceci Posted March 2, 2010 Share Posted March 2, 2010 Hi all. I have a mysql table with two main columns ColumnX and ColumnY each containing data in '|' delimited format. Eg. Column X = |A|B|C|D|E| and Column Y = |a|b|c|d|e| Using this data column X and Column Y I need to Dynamically construct a table like the one below. The end-user will be able to enter a value for each corresponding X,Y value. eg. good bad. See attached file for screenshot. <table border="2"> <tr> <td> </td> <td>A</td> <td>B</td> <td>C</td> <td>D</td> <td>E</td> <td>F</td> <td>G</td> </tr> <tr> <td>a</td> <td>good</td> <td>good</td> <td>good</td> <td>bad</td> <td>good</td> <td>good</td> <td>good</td> </tr> <tr> <td>b</td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td>c</td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td>d</td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <td>e</td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <td>f</td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <td>g</td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> </table> Take a look at this image to give you a better idea of what I need to accomplish. http://audiologyonline.com/resources/article/hatchertable.png What would be the best way to accomplish this? Thank you so much. Ceci [attachment deleted by admin] Quote Link to comment Share on other sites More sharing options...
Goat Posted March 2, 2010 Share Posted March 2, 2010 take a look at this http://www.phpfreaks.com/forums/index.php/topic,289377.0.html Your table has one more dimension, but I think starting principle is similar. You'll have to output something like: <input type="text" name="thing[3][5]"> You might need either for or foreach loop, I am not right away sure which. Goat Quote Link to comment Share on other sites More sharing options...
ceci Posted March 2, 2010 Author Share Posted March 2, 2010 Thanks for the link its somewhat helpful. To make things simpler, say I have two variables. $var1 = |A|B|C|; $var2 = |X|Y|Z|; how do i generate dynamically table with a top header with A B C and a LEFT COLUMN with X Y Z? I am hoping that once this is figured out, things will start to make sense at least on my end. Right now I am just stumped as to how to achieve this... I hope someone has an example I can take a look at. Thanks again. C Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.