There’s a dropdown displaying 1-10 from where the user selects the number of textboxes he wants – if he chooses unlimited, it shows him a textbox wherein he enters the exact number of textboxes he’d like. if he enters 40, it shows him 40 textboxes which are created at runtime.
My question is, how do I enter the data from 40 – or ‘whatever number he enters’ textboxes into the MS SQL database. There’s no way I can create a column name dynamically, and that’d be too tedious and messy. Is there any way I can do this?
What you have is a 1-to-many relationship between whatever it is that is on that page and the comments or descriptions or whatever. You shouldn’t have this modeled in your database as text_box_1, text_box_2, etc. Instead, it should be:
Once that’s done, you can use code similar to what Mun wrote to handle things on the front end. You’ll just pass the text box index as the comment_number.