I have a flat CSV file which I need read from to end up with 3 select boxes for region, country, city.
I’m using jQuery to load the csv file, and jQuery Csv plugin to return the csv file as an array.
I have looped through the array and built an array of the countries, but am now struggling to add the cities to the array. What structure would be best? Ideally I just want to loop over the csv once, and end up with one nested array, which has regions, then countries ten cities.
Is this a case for an associative array?
Thanks for any help.
Ian.
Yes, associative arrays are fine for that, something like this: