Jump to content

DB Query with Checkbox group


loganbest

Recommended Posts

Hi,

 

I’m fairly new to OOPHP and CI so I had a quick question that could be an easy answer for some people.

 

I have a form right now with about 100 checkboxes all with the same name so they will submit as an array of numbers.

 

I also have a table named tag_restaurant_rel which is a relational table that is setup as InnoDB and both `restaurant_id` and `tag_id` are Foreign Keys relating to the corresponding columns in two other tables.

 

The form will be submitted with 1 restaurant_id and several tag_id’s.

 

In the tag_restaurant_rel table there is a record for each tag_id in the array all with the same restaurant_id from the form.

 

What I need to happen is for the form to be submitted and depending on the array of checkbox values the tag_restaurant_rel table will need to delete the records that are not in the array and create a new record for each tag_id in the array.

 

I’m mostly curious in the most efficient way to do this OOP and CI style.

Link to comment
https://forums.phpfreaks.com/topic/235872-db-query-with-checkbox-group/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.