Page 1 of 1

building a categorie system

Posted: Sat Mar 28, 2009 5:52 pm
by dsick
[moved by moderator to PHP - Code forum]
ok, this will have a option drop down menu, with all the categories a user can upload to, could i use if isset to test if a option is selected, then when it is i am going to write to that table the user selected, i will put the write query after the if statement and i will put the if statement after the drop down menu, but my only problem is i would have to do the if statement for each category and if i have more than 30 categories my coding can get messy, im looking for something i can use that will test if a category is selected without having to test every category
i will also have to switch the type of the categories so i can wrap them in a if isset test. unless i can put plain text into an if statement. i think im going about this the wrong way as i shouldn't test if the category is selected, i should test if the option number is selected because my categories might change.

Re: building a categorie system

Posted: Mon Mar 30, 2009 4:32 am
by mattpointblank
Are you saying you're putting rows into a different table depending on what category the item is in? Why not simplify your database and just store the category ID in a single table? Then no need for lots of switches, just use the ID value.