I am creating a website for a Pharma Distributors Association. The Members could be representing various Pharmaceutical Companies. This is the Scenario.
A Member could be a distributor for N number of Parent Companies .
He Could represent All or N Divisions of a Parent Company.
The Parent Companies could be anything from 400 - 600 and will be updated as and when New Companies are found.
Each Parent Company could have N number of Divisions within itself.
I have created these Tables
1.Table Parent_Companies (data entered by Admin)
Columns - Company_ID (Autoincremented), CompanyName
2.Table Divisions
Columns - Company_ID, Division_ID(Autoincremented), DivisionName
The DivisionName are entered thru a form by Admin. This Form has CompanyName values as dropdown, but returns the respective Company_ID to the Table2
3.Table Distributor_Companies
Columns - Distributor_ID, CompanyDivision
==================================================
Now this where I'm stuck
I would like to have the Member Select the Company Divisons he represents from a Form. Since the Companies data would be in 1000s, I dont want to use a Drop-Down.
I presume that a 25 Line List-Box would be a better option from which Companies can be added to another multi-line Text-box. The Options in the ListBox should be concatenated as "Parent Company - Division".
How do I do this? I've found a java script that does the Adding/ Removing between the ListBox and TextBox. But I've not been able to figure out how I could store each "Parent Company - Division" as a record in Table3. (I dont want to store as an array)
I understand that I need to use a Loop here, just cant figure out how to do it.
Also, how would I able to genrate a mail to the Admin with details of all the Parent Company - Divisions when the Member submits the Form?
On the other hand, would it be easier to key in the Divisions as "Parent Company - Division" itself in the 1st place in Table1 and avoid Table2?
Is there a simple solution or am I complicating things?
Thanx for the support