mercredi 25 avril 2018

Dynamically populated select menus in Laravel5

In a view I have a couple of select menus that are populated by data from two separate tables.

Looking for a way to populate the second select menu depending on the value of the first.

<div class="form-group">
    
    <select selected="" class="form-control" id="company" name="university">
        @foreach($company as $key)
            <option value=""></option>
        @endforeach
    </select>
</div>
<div class="form-group">
    
    <select selected="" class="form-control" id="department" name="department">
        @foreach($faculty as $key)
            <option =value""></option>
        @endforeach
    </select>
</div>

This feels like something that shouldn't be too hard, but have yet to find any good information about it.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire