Jump to content

I don't know how to tackle this problem!


Emkay

Recommended Posts

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?

Link to comment
https://forums.phpfreaks.com/topic/242842-i-dont-know-how-to-tackle-this-problem/
Share on other sites

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.