Hey Guys,
I have an html table which is generated with php using a mysql database. The database contains a list of operating systems. It is shown as a form and items may be ticked or unticked dependant on whether the user wants to receive information about those OS's. What is the best way of managing the form and mysql changes when someone ticks, or unticks items on the list?
I was wondering about just truncating the existing data from the table and recreating the table based on what was ticked. With large numbers of users, or operating systems I figured this approach wasn't the most efficient. A friend suggested using javascript as a way of detecting which fields had changed, so I could write a query just to update those that had been modified? Each operating system has it's own record in a many-to-many table so the query needs to update a bunch of these records, not just one.
I'm unsure as to how to write the mysql query based on this form once it's been submitted. Each checkbox has it's own ID (which represents the OS in the database). If 30 records are changed would I best write a for loop of some sort to loop through each of the id's that have changed updating the sql database as it goes? even with a for loop I wouldnt know which records had changed.
I apologise for the length and number of questions, I've done a fair bit in php and mysql before but not anything this specific. Any help appreciated.
Cheers