Can anyone tell me how to make a multidimentional array?
I'm trying to keep the Main Categories and the Sub-Categories in the same table. The table structure is like this:
id (auto_increments)
MainCategory (has Autos, Advertising, etc.)
SubCategory (has Newspaper, Magazine Ads, Billboards, Repair Garages, etc.)
What I am doing is trying to output select boxes on a web site like so:
id MainCategory SubCategory
1 Advertising Newspaper Ads
2 Advertising Newspaper Ads
3 Advertising Newspaper Ads
4 Autos Repair Garages
5 Autos New Cars
6 Autos Used Cars
// I get the main category from the db and remove the extra ones.
$Headings = array_unique(MainCategory);
// This is where I'm stuck.
// I need to output each <select name=".. just one - which I can do. But then I need to extract the id and the SubCategory and insert them into the <option value="... menus.
// What I need to do (I think) is insert the three sub-arrays into each element of the big array (Advertising, Autos, etc.)
<select name="Advertising[]" multiple size="7">
<option value="1">Newspaper Ads</option>
<option value="2">Magazine Ads</option>
<option value="3">Billboards</option>
</select>
<select name="Autos[]" multiple size="7">
<option value="4">Repair Garages</option>
<option value="5">New Cars</option>
<option value="6">Used Cars</option>
</select>
Thanks.