Here is the issue.
I have two databases/tables, 1 database table holds data for PAGES and the 2nd database table holds ARTICLES for that page. They are connected by THE ID field in the PAGES to the PAGEID in the ARTICLES.
I am using a series of check boxes to display the current pages from the PAGES table. This gives the user the ability to check off the pages they don’t want to keep and check the ones they want to keep.
Originally I was just going to run a query to delete them all and than insert the checked ones since the checkboxes are coming over in an array called pages[]. It just seemed easier to do that. But now the issue is by deleting them I am removing the articles from that page since it will assign and new ID to the PAGE entry. I hope that makes sense. Here is the basic structure of the tables I am using…
PAGES
ID
PAGE
PAGEORDER… as so on!!
ARTICLES
ID
PAGEID
ARTICLE… as so on!!
In the ARTICLES PAGEID is equal to the ID field in PAGES
What is the easiest way to update these fields using the checkbox format. Keeping in mind the ones they deselect will be deleted and the ones they select that haven’t been added yet will be added. Of course the ones that already exist will not be touched. Not sure how to update this easily.
The easy way would of course be to add, remove, update pages per a regular input field but I would prefer to use check boxes to display this.
Any help would be greatly appreciated. Thank you.