Hello,
I'm having a problem updating a Section lookup table
from a checkbox array, and need some help.
I have an EDIT page that loads all the current
Sections for each Product, using checkboxes.
The code I'm currently using works (see attachment),
BUT, I'm using a cheap hack when the form is submitted:
1) I Delete all entries in the lookup table for that Product ID. (this sucks!)
2) Then, Add the new selections (checked items) to the lookup table for that Product ID.
I could live with this, EXCEPT my Section lookup table also includes a column
for ordering the items in that section, and when I delete all entries
for a Product ID, the ordering for that section becomes useless.
What I want to do is:
1) If an item remains checked (no change), DO NOTHING.
2) If an item that was previously checked is UNCHECKED, DELETE IT.
3) If an item that was previously unchecked is CHECKED, ADD IT.
Simple, huh?
The only thing looping right now is my brain,
and any suggestions are welcome!
The attached Zip file includes:
1) index.php - Change the username/password and database name at the top.
2) SQL dump to create two tables (tbl_section and tbl_sectionlookup).
3) Image icons for sections also included.
Batteries not included.
Thanks!