about database and loop |
I have some data in my database :
Code: |---|--------------|----------------| I call all the data where : Code: country_code = session()->getFlashdata('customer.addr_country') And loop them, because I want to display in view with form_dropdown() and old() function. I create the loop like this : PHP Code: $_list_province = ['HIDE_' => 'Provinsi']; The $row['province] show the province that listed in database (where country_code), but the $row['id'] can not display from 11, 12, ... (as in database) it shows number from 0,1,2,3 .... until end. I think its not good, because I need the $row['id'] display data from database (11,12, ...) this is some of the output Code: <option value="" hidden="" >Provinsi</option> if I do or try to array it again PHP Code: $_list_province = array_merge([$_list_province]); it show : Code: <optgroup label="0">
I got the problem, form_dropdown() function change the number become reorder again from 0 until end. I try add "_" character before $row['id'] and it shows the number with good (I don't use optgroup)
|
Welcome Guest, Not a member yet? Register Sign In |