Emkay Posted July 26, 2011 Share Posted July 26, 2011 I am currently working on a project. Simply put it's a mix between ebay and gumtree. I want users to be able to post listings of different categories, and each category will need different data stored about each listing. How do I go about structuring this? I am currently using a main listings table in the database and further separate tables (that are linked by foreign ID) to the main table to contain the other fields. When a user wants to create a listing however, I initially have a dropdown so a category can be chosen, but after that it all becomes a nightmare, since the add listing form will be different for each category, do I just a separate form for each and a separate PHP form handler or is there a more integrated and efficient way to go about it? Quote Link to comment https://forums.phpfreaks.com/topic/242842-i-dont-know-how-to-tackle-this-problem/ Share on other sites More sharing options...
marcelobm Posted July 26, 2011 Share Posted July 26, 2011 For each different category, no matter how different is the form you will have some common fields between them, so what I would do is, after I choose the category I want, I made a request to the file that generates the forms in which I'll put a switch statement that will give me the right fields for the category selected, as for the php handling of the submitted data, is about the same a switch statement that handles the data as required. Quote Link to comment https://forums.phpfreaks.com/topic/242842-i-dont-know-how-to-tackle-this-problem/#findComment-1247282 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.