FooKelvin Posted January 17, 2016 Share Posted January 17, 2016 (edited) Hi Guys, I have created a html which consist of a list of check box and open text comment. <html> <body> <form action="" method="post" enctype="multipart/form-data"> <div style="width:200px;border-radius:6px;margin:0px auto"> <table border="1"> <tr><td>Name</td><td><input name="name"/></td></tr> <tr> <td colspan="2">Select Technolgy:</td> </tr> <tr> <td>PHP</td> <td><input type="checkbox" name="techno[]" value="PHP"></td> </tr> <tr> <td>.Net</td> <td><input type="checkbox" name="techno[]" value=".Net"></td> </tr> <tr> <td>Java</td> <td><input type="checkbox" name="techno[]" value="Java"></td> </tr> <tr> <td>Javascript</td> <td><input type="checkbox" name="techno[]" value="javascript"></td> </tr> <tr> <td>Comments</td> <td><input name="comment"/></td> </tr> <tr> <td colspan="2" align="center"><input type="submit" value="submit" name="sub"></td> </tr> </table> </div> </form> </body> </html> I manage to store the check box and comment in a database. I store each submit check box in a same column of data and i separated the multiple check box value with comma. My question is, how to turn those data, how can i compare those value and generate a report like this? Edited January 17, 2016 by FooKelvin Quote Link to comment Share on other sites More sharing options...
benanamen Posted January 17, 2016 Share Posted January 17, 2016 (edited) Your doing it wrong. You dont store the data like that in the same column. You need another table with a foreign key to the first table and do a JOIN. Look up database normalization. Edited January 17, 2016 by benanamen Quote Link to comment Share on other sites More sharing options...
FooKelvin Posted January 17, 2016 Author Share Posted January 17, 2016 Your doing it wrong. You dont store the data like that in the same column. You need another table with a foreign key to the first table and do a JOIN. Look up database normalization. Do you mean i cannot store those check box value with comma in a same row? Quote Link to comment Share on other sites More sharing options...
benanamen Posted January 17, 2016 Share Posted January 17, 2016 (edited) Do you mean i cannot store those check box value with comma in a same row? You can if you want to do it wrong and go against proper database design and create headaches for yourself and any other developers that has to deal with it down the road as well as anyone offering you help. I gave you a starting point. Look up database normalization and learn it. It is a very important foundation to database design and is one of the simplest things you can master in as little as 10 minutes. Come back with your normalized structure if you are still stuck and we will be happy to help you. * You also didn't post your code, just the form. We cant review what we cant see. Edited January 17, 2016 by benanamen 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.