Please anyone suggest how to display data in dropdown list? what code will be use in option attribute?
My Controller
public function tableReports()
{
$data['tables']=$this->DbReports->selectTable('snehal_pharma');
$this->load->view('reports/rpt.php');
}
Model Code
function selectTable($db)
{
$query=$this->db->list_tables();
print_r($query);
return $query;
}
View
<div class="span12">
Table List :
<select name="tbl" style="width: 150px;">
<?php foreach($tables->result() as $tbl){ ?>
<option><?php echo $tbl;?></option>
<?php } ?>
</select>
</div>
Output
Array ( [0] => account_groups [1] => account_undergroup [2] => batch_master [3] => batch_packing [4] => batch_stock [5] => company_master [6] => cost_sheet [7] => cost_sheet_details [8] => customer [9] => departments [10] => disp_material [11] => dm_gatepass [12] => equipment_master [13] => es_finance_master [14] => es_ledger [15] => es_voucher [16] => es_voucherentry [17] => exipient [18] => mail_date [19] => pm_issue [20] => purchase [21] => purchase_details [22] => purchase_indent [23] => purchase_items [24] => purchase_master [25] => purchase_order [26] => sales [27] => sales_details [28] => sales_items [29] => sales_master [30] => sop_master [31] => stock_register [32] => stockcategory [33] => stockmaster [34] => supplier_master [35] => supply_order [36] => taxcategories [37] => tbl_state [38] => tbluser [39] => unit_pack [40] => unitsofmeasure [41] => view_salesledger [42] => viewbatchstock [43] => www_users [44] => zformulamaster [45] => zpackmaster )
<option value="<?php echo $tbl;?>"><?php echo $tbl;?></option>not working. is there any error ?