Lets say I have a newspaper type database.
I have an article table with the following columns:
Article_ID
Article_Name
Then I have a Article Category Table with the following Columns:
Category_ID
Category_Name
Then I have another table that links to two together with the following columns:
Article_ID
Category_ID
I want a make a form that displays all of the Categories with a select statement that delivers code similar to the following so that I can select which category the News Article can go to:
<input type=“checkbox” name=“option1” value=“(category_id_1)”> News<br>
<input type=“checkbox” name=“option2” value=“(category_id_2)”> Sports<br>
<input type=“checkbox” name=“option2” value=“(category_id_3)”> Weather<br>
For each option checked I want to put a seperate entry in the third table I mentioned.
So lets say that I am adding an article. The article ID ends up being 557 and I select Sports and Weather I want to add two entries with the following data:
Article_ID - Category_ID
557 - 2
557 - 3
What is the best way for me to go about doing this?