Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Controller
- class Test extends CI_Controller {
- public function index()
- {
- $this->load->model('Testmodel');
- $data=array(
- 'barang'=>$this->Testmodel->getbarang()
- );
- $this->load->view('testindex', $data);
- }
- }
- #Model
- class Testmodel extends CI_Model {
- function getbarang(){
- return $this->db->get('produk')->result();
- //Sesuaikan nama tabelnya
- }
- }
- #View
- <form action="<?=base_url('test/post')?>" method="post">
- <input type="number" name="mutasi" id="" placeholder="No. Mutasi">
- <input type="text" name="kode" id="" placeholder="Kode Ruang">
- <select name="barang" id="">
- <option value="">Pilih Barang</option>
- <?php
- foreach($barang as $key){
- ?>
- <option value="<?=$key->id_produk?>"><?=$key->nama_produk?></option>
- <?php
- }
- ?>
- </select>
- </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement