php - Fuelphp: populate data in database to dropdown -
i have dropdown , want inside of it, data database. dropdown working little bit fine. problem have 2 data in database display 1 data.
this code in view.php:
<h4>choose deck: </h4><?php foreach ($models $key=>$value); echo form::select('country', 'none', array( ' ' => '', $value['id'] => $value['deckname'] )); ?> and display here: 
as can see in picture have 2 data shows one.what wrong code? suggestions please
ah, got it. problem doing 2 selects same name. since second item last, been shown because overwrites else (with same name).
do this:
<h4>choose deck: </h4> <?php $select = array(); foreach ($models $key => $value) { $select[$value['id']] = $value['deckname']; } array_unshift($select, ''); echo form::select('country', 'none', $select); ?>
Comments
Post a Comment