I am having issues trying to figure something out. I pass my view an array of data which takes the following form
array:4 [▼
"data" => array:2 [▼
2015 => array:2 [▼
"english" => array:1 [▼
"chips" => array:1 [▼
0 => "img1.png"
]
]
"french" => array:1 [▼
"mussles" => array:1 [▼
0 => "img1.png"
]
]
]
2016 => array:2 [▼
"indian" => array:1 [▼
"madras" => array:1 [▼
0 => "img1.png"
]
]
"italien" => array:1 [▼
"pasta" => array:1 [▼
0 => "img1.png"
]
]
]
]
]
This stucture is obtained from scanning a directory structure, but it should be pretty consistent. The overall structure is
Year>Country>Dish>Images
I need to somehow display this data within select options. So year is pretty straight forward, I can do this
<select id="yearSelection" class="selectpicker form-control">
@foreach($fileData["data"] as $year => $country)
<option value=""></option>
@endforeach
</select>
Here is my problem. So the above select will display 2015 and 2016. I then have a second select input
<select id="countrySelection" class="selectpicker form-control">
<option value=""></option>
</select>
Now depending on what year they select is going to determine what this select should display. So if they select 2015, this select should display english and french.
How can I populate my select options based on previous selections?
Thanks
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire