I'm currently trying the following (simplified objects):
I have a bunch of "objects", which are cities. Each city has a relating country (even though I'm not sure how to implement this relation, yet), so for example I have the following cities:
Stuttgart - Germany
Berlin - Germany
Dresden - Germany
Paris - France
Marseille - France
Lyon - France
New York - USA
Chicago - USA
LA - USA
Miami - USA
Peking - China
Shanghai - China
Hongkong - China
I think you get what I mean.
Additionally, I have some checkboxes, including the country, so in the case of the list provided, I would 4 checkboxes, one for Germany, one for France, one of USA and one for China.
When ticking one of this checkboxes, the relating cities should appear underneath, when ticking two of the checkboxes, the cities of both checked countries should appear, and so on.
Actually, I have no idea how to get this started. In a normal web application, I would just create a database table with 3 columns (ID, City, Country) and then in my frontend just react on the checkbox.change
, send AJAX to a php file, which gets the requested objects from database (something like select * from tbl_cities where country=germany
) and just echo
them.
Is something similar possible in Wordpress? Are there plugins for things like that, or how could I get this started?