How on earth do I make this work?
I have a database with 3 tables.
Table 1: Categories
Table 2: Organisations
Table 3: Link table with 2 colums: Category id, Organisation id.
I want to make this interface:
http://www.glowong.nl/Uploads/26-03-2012-13-46-52.jpg
When I click on ‘Opslaan/save’. The new connections should be written to Table 3.
I don’t know where to start.
At first glance, I would do something like so:
1) When you render the page HTML, make each Organization a named array of checkboxes where the values are the categories, like so:
etc
2) When the form is submitted, loop through your org/categories like so:
I think something like that would work. You could have problems with this solution if you have a whloe bunch of orgs and categories since we’re doing a Cartesian-ish join in the loops, but if you have that many orgs and categories you may need to rethink your interface anyhow.