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
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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.