I have a table that will be passed a buisiness ID and a category ID. The problem is a business may be in more than one category, so I have decided to use a multiple select box. I understand that I need to make an array like so:
<select name="cid[]" size="4" multiple>
Now, how do I insert this data into the table? The form will primarly populate a BUISNESS table. From this data, I will use the last insert ID to populate the bid of the BUSINESS_CATEGORY table. I know how to do this with one item like so:
mysql_query("INSERT INTO business_tabl (b_name, b_address ...) VALUES ('$bname','$b_address'....)");
$_insertedBusinessID = last_insert_id();
mysql_query("INSERT into business_category (cid, bid) values ('$cid', '$_insertedBusinessID')")
The trick is cycling through the array to populate the BUSINESS_CATEGORY table.