View Full Version : Resolved advice on best method to use

09-14-2011, 12:50 PM
hi guys. im looking for some advice on the best way to do the following (new baby and lack of sleep seem to have seriously hampered my IQ! :))

i have a form (safety_pack.php) & associated sql table (safety_packs)

on this form i need users to pick from a list of safety items, im using checkboxes for this (the items are in a sql table called safety_pack_items)

im trying to figure out the best way to link this up. i know i could cycle though the items (about 100) and use ajax to create/delete items in another table (maybe safety_pack_item_selections) that would just have the id of the item and the id of the safety pack. but all those lookups when the page loads could slow things down a bit. the toggling bit would be instant and easy enough to do in ajax. im more concerned with 100+ little lookups on page loading.

i could just cop out and create all the items onto the safety_pack table as fields but then adding new items or removing them would be a pain and im trying to build this in a modular fashion with a possibility of reselling to small building companies.

edit: i guess i could create a text field on the safety_packs table and just add/remove the id to it? that might be quicker and hide that field on the form.

sorry if this doesnt make sense. im fuelled on lots of coffee and seriously lacking sleep!

09-14-2011, 03:39 PM
ok, the idea in my edit works very well.

all sorted! :)