Title: Conditional Fields depending on checkboxes
Last modified: 31. März 2018

---

# Conditional Fields depending on checkboxes

 *  [namelessflorian](https://de.wordpress.org/support/users/namelessflorian/)
 * (@namelessflorian)
 * [vor 8 Jahren, 3 Monaten](https://de.wordpress.org/support/topic/conditional-fields-depending-on-checkboxes/)
 * 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?
 * To clarify, it’s html that should be displayed then, like a list or something,
   so if selecting germany, I would have something like a `<ul>` with `foreach($
   cities as $c){ echo "<li>".$c."</li>";}`, but I need the thing around, how do
   I get the cities and how do I react on the checkboxes and where do I store cities
   and countries

Ansicht von 1 Antwort (von insgesamt 1)

 *  Moderator [Bego Mario Garde](https://de.wordpress.org/support/users/pixolin/)
 * (@pixolin)
 * Moderator (nicht mehr aktiv)
 * [vor 8 Jahren, 3 Monaten](https://de.wordpress.org/support/topic/conditional-fields-depending-on-checkboxes/#post-47299)
 * [@namelessflorian](https://de.wordpress.org/support/users/namelessflorian/)
    **
   Moderation Note:** I close this thread as you have asked your question in a German
   support forum in English. To keep the threads accessible to all people not speaking
   English, I kindly ask you to either rephrase your question in German or ask in
   the [International support forums](https://wordpress.org/support/). Thank you
   for your understanding. Best regards, Bego

Ansicht von 1 Antwort (von insgesamt 1)

Das Thema „Conditional Fields depending on checkboxes“ ist für neue Antworten geschlossen.

## Schlagwörter

 * [ajax](https://de.wordpress.org/support/topic-tag/ajax/)
 * [conditional content](https://de.wordpress.org/support/topic-tag/conditional-content/)
 * [html](https://de.wordpress.org/support/topic-tag/html/)
 * [JavaScript](https://de.wordpress.org/support/topic-tag/javascript/)
 * [JS](https://de.wordpress.org/support/topic-tag/js/)
 * [PHP](https://de.wordpress.org/support/topic-tag/php/)
 * [Plugins](https://de.wordpress.org/support/topic-tag/plugins/)
 * [wordpress](https://de.wordpress.org/support/topic-tag/wordpress/)

 * In: [Allgemeine Fragen](https://de.wordpress.org/support/forum/allgemeine-fragen/)
 * 1 Antwort
 * 2 Teilnehmer
 * Letzte Antwort von: [Bego Mario Garde](https://de.wordpress.org/support/users/pixolin/)
 * Letzte Aktivität: [vor 8 Jahren, 3 Monaten](https://de.wordpress.org/support/topic/conditional-fields-depending-on-checkboxes/#post-47299)
 * Status: nicht gelöst

## Themen

### Beliebteste Themen

### Unbeantwortete Themen

### Nicht-Support-Themen

### Gelöste Themen

### Ungelöste Themen

### Alle Themen
