I have a junction table to link a many to many relationship between the table SERIES(PK series_id) and GENRE(PK genre_id). The form I have set up uses check boxes, like so:
<tr><td><input type="checkbox" name="genre" value="1" />Action </td>
<td><input type="checkbox" name="genre" value="2" />Adventure </td></tr>
<tr><td><input type="checkbox" name="genre" value="3" />Comedy</td>
<td><input type="checkbox" name="genre" value="4" />Coming of Age</td></tr>
The table in SQL appears like so, for example:
SERIES_ID GENRE_ID
A0000 1
A0000 2
B0000 2
B0000 6
C0000 1
The integers of genre_id reference the GENRE table where they are explained. For example, as you see above, 1 = Action.
So how would I go about making PHP that would allow me to insert into this junction table multiple rows with the same SERIES_ID and different GENRE_ID's. Like a user wants to submit a new series by the ID D0000 and it is both an action and adventure, so we would need to add these two rows with this form:
D0000 1
D0000 2
All the code I have been able to uncover regards counting the check boxes. I know that there is must be way but haven't been able to find it.