0

I have a select list with a number of option tags. For each option tag, I want to display multiple values to the user.

<option value="' . $location['locationId'] . '">' . $location['locationName'] . '</option>

Instead of only displaying the $location['locationName'], I would like to display values contained to that location, ex: $location['city'], $location['province']

I can't seem to find a way to display this in an appealing way.

Here is my select list in complete:

<select class="form-control" size="10" name="locationId">';
    foreach ($locations as $location) {
        $pageContent[] = '<option value="' . $location['locationId'] . '">' . $location['locationName'] . '</option>';
    }
    $pageContent[] = '</select>
Liam Paquette
  • 79
  • 1
  • 7
  • 1
    `$location['locationName'] . ' - ' . $location['city'] . ' - ' . $location['province']` ? – AymDev Aug 29 '18 at 13:40
  • may be this can help you what you want. **https://stackoverflow.com/questions/3245967/can-an-option-in-a-select-tag-carry-multiple-values** – Nadee Aug 29 '18 at 14:06
  • AymDev, I thought of that solution, my issue with it is that it won't be visually appealing as the values will not line up with each other – Liam Paquette Aug 29 '18 at 14:20

0 Answers0