CodeIgniter Forums
BAGAIMANA CARA MENGAMBIL DATA DARI HALAMAN SEBELUMNYA - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: General (https://forum.codeigniter.com/forumdisplay.php?fid=1)
+--- Forum: Regional User Groups (https://forum.codeigniter.com/forumdisplay.php?fid=25)
+--- Thread: BAGAIMANA CARA MENGAMBIL DATA DARI HALAMAN SEBELUMNYA (/showthread.php?tid=80983)



BAGAIMANA CARA MENGAMBIL DATA DARI HALAMAN SEBELUMNYA - ronysumardi - 01-10-2022

mohon bantuannya, saya baru
bagaimana cara mengambil data dari halaman sebelumnya


nama file iuran.php dan saya mau ambil data no_ktp
PHP Code:
<button class="btn btn-primary" data-toggle="modal" data-target="#tagihan">Buat Tagihan Iuran Bulanan</button>
<
br><br>
<?
php 
foreach($i as $a) { ?>
<div class="card">
 <div class="header bg-blue">Data Iuran Bulanan, Tahun <?php echo $a->tahun;?></div>
 <div class="body">
 <!--  -->

 <!-- Nav tabs -->
        <div class="alert bg-orange">
            Data Belum Bayar    
        </div>
        
                            <ul class="nav nav-tabs tab-nav-right" role="tablist">
                            <?php foreach(get_bulan_iuran($a->tahun) as $b){ ?>
                                <li role="presentation"><a href="#<?php echo $b->bulan.$b->tahun;?>" data-toggle="tab"><?php echo $b->bulan;?></a></li>
                                <?php };?>
                            </ul>

                            <!-- Tab panes -->
                            <div class="tab-content">
                            <?php foreach(get_bulan_iuran($a->tahun) as $b){ ?>
                                <div role="tabpanel" class="tab-pane fade in" id="<?php echo $b->bulan.$b->tahun;?>">
                                    <table class="table table-bordered table-striped table-hover dataTable js-exportable">
                                    <thead>
                                    <th>No</th>
                                   <th>No. KTP</th>
                                    <th>Nama</th>
                                    <th>No Rumah</th>
                                   <th>Aksi</th>
                                    </thead>
                                    <tbody>
                                            
                                    <?php $no=0; foreach($tampil as $c):$no++;?>
                                    <?php if(cek_tagihan_current($b->id_b_iuran$c->no_ktp)==NULL){ ?>
                                    <tr>
                                    <td><?php echo $no;?></td>
                                   <td><?php echo $c->no_ktp;?></td>
                                    <td><?php echo $c->nama_lengkap;?></td>
                                    <td><?php echo $c->no_rumah;?></td>    
                                                        
                                                      
                                                        <td><a href="<?php echo base_url('Home/bayar_iuran_manual/' .$b->id_b_iuran);?>" class="btn btn-primary">Bayar</a></td>
                                                        

                                        
                                        </tr>
                                                                            
                                                                                          
                                    <?php ?>
                                    <?php endforeach;?>
                                          
                                    </tbody>
                                    </table>
                                </div>
                                <?php };?>
                            </div>
 <!--  -->
        <!--  -->
        <!-- Nav tabs -->
        <div class="alert bg-green">
            Data Sudah Bayar    
        </div>
                            <ul class="nav nav-tabs tab-nav-right" role="tablist">
                                <?php foreach(get_bulan_iuran($a->tahun) as $b){ ?>
                                <li role="presentation"><a href="#sudah<?php echo $b->bulan.$b->tahun;?>" data-toggle="tab"><?php echo $b->bulan;?></a></li>
                                <?php };?>
                            </ul>

                            <!-- Tab panes -->
                            <div class="tab-content">
                                <?php foreach(get_bulan_iuran($a->tahun) as $b){ ?>
                                <div role="tabpanel" class="tab-pane fade in" id="sudah<?php echo $b->bulan.$b->tahun;?>">
                                    <table class="table table-bordered table-striped table-hover dataTable js-exportable">
                                        <thead>
                                            <th>No</th>
                                            <th>Nama</th>
                                            <th>No Rumah</th>
                                            <th>Nominal</th>
                                            <th>Bukti</th>
                                        </thead>
                                        <tbody>
                                            <?php $no=0; foreach(get_ktp_iuran($b->id_b_iuran) as $c):$no++;?>
                                            <?php if(get_ktp_iuran($b->id_b_iuran)!=null){ ?>
                                            <tr>
                                                <td><?php echo $no;?></td>
                                                <td><?php echo $c->nama_lengkap;?></td>
                                                <td><?php echo $c->no_rumah;?></td>
                                                <td><?php echo rupiah($c->besaran);?></td>
                                                <td><a href="<?php echo base_url('assets/upload/'.$c->no_ktp.'/'.$c->bukti);?>" class="btn btn-primary">Lihat</a></td>
                                            </tr>
                                            <?php ?>
                                        <?php endforeach;?>
                                        
                                        </tbody>
                                    </table>
                                </div>
                                <?php };?>
                            </div>
        <!--  -->
 </div>
</div>

<?php };?>

<form action="<?php echo site_url('Panel_rt/buat_tagihan');?>" method="post">
<div class="modal fade" id="tagihan" tabindex="-1" role="dialog">
                <div class="modal-dialog modal-lg" role="document">
                    <div class="modal-content">
                        <div class="modal-header">
                            <h4 class="modal-title" id="largeModalLabel">Buat Tagihan Iuran Bulanan</h4>
                        </div>
                        <div class="modal-body">
                          <div class="form-group form-float">
                              <div class="form-line">
                                  <input type="text" name="bulan" class="form-control" required>
                                  <label class="form-label">Nama Tagihan / Nama Bulan</label>
                              </div>
                          </div>
                        </div>
                        <div class="modal-footer">
                            <button type="submit" class="btn btn-primary waves-effect">SIMPAN</button>
                          
                        </div>
                    </div>
                </div>
            </div>
            </form> 


bayar_iuran_manual.php
PHP Code:
<div class="card">
 <
div class="header bg-blue">Pembayaran Iuran Manual Bulan <?php echo $i['bulan']." ".$i['tahun'];?></div>      
        
 <div class="body">

 <form action="<?php echo site_url('Home/bayarkanmanual/');?>" method="post" enctype="multipart/form-data">
 <input type="hidden" name="id_b_iuran" value="<?php echo $i['id_b_iuran'];?>">
 <input type="hidden" name="id" value="<?php echo $id;?>">
                        
                        
 <div class="form-group form-float">
 <div class="form-line">
 <input type="number" name="besaran" class="form-control" required>
 <label class="form-label">Nominal </label>
 </div>
 </div>
 <div class="form-group">
 <label class="form-label">Metode Pembayaran</label>
 <select name="via" class="form-control" required>
 <option value="">--Pilih--</option>
 <option value="Transfer">Transfer</option>
 <option value="Cash">Cash</option>
                                        
 </select>
 </div>
 <div class="form-group">
 <label class="form-label">Bukti</label>
 <input type="file" name="bukti" class="form-control">
 </div>
 <div class="form-group">
 <button type="submit" class="btn btn-primary">Bayarkan</button>
 </div>
 </form>
 </div>
</div> 





untuk dipakai di halaman home.php

PHP Code:
  function bayar_iuran_manual($id)
 {
 
$data = array(
 
'content' => 'dashboard/bayar_iuran_manual.php',
 
'i' => $this->db->query("SELECT * from buat_iuran where id_b_iuran='$id'")->row_array(),
 
'id' => $id
                    

 
);

 
$this->load->view('template'$data);
 }
        
        
        
function bayarkanmanual()
 {
                                
 $ktp    
MAU SAYA AMBIL DATA NO_KTP dari IURAN.PHP DAN DITAMPILKAN DISINI;
 
$id $this->input->post('id');
 
$rt get_rt_by_ktp($ktp);
 
$config['upload_path'] = './assets/upload/'.$ktp.'/';
 
$config['allowed_types'] = 'jpg|jpeg|png|bmp';
 
$config['max_size'] = '5000';
 
$config['file_name'] = $ktp.'_buktiIuran';
 
$this->load->library('upload',$config);

 
$this->upload->do_upload('bukti');
 
$upload_data = array('uploads' => $this->upload->data());
 
$config['image_library'] = 'gd2';
 
$config['source_image'] = './assets/upload/'.$ktp.'/'.$upload_data['uploads']['file_name'];
 
$this->load->library('image_lib'$config);
 
$data = array(
 
'id_b_iuran' => $this->input->post('id_b_iuran'),
 
'no_ktp' => "$ktp",
 
'besaran' => $this->input->post('besaran'),
 
'via' => $this->input->post('via'),
 
'tgl_bayar' => date('Y-m-d H:i:s'),
 
'bukti' => $upload_data['uploads']['file_name']
 );

 
$pendapatan = array(
 
'rt' => $rt,
 
'nama_item' => 'Iuran Bulanan dari ' .$ktp,
 
'nominal' => $this->input->post('besaran'),
 
'jenis' => 'pendapatan',
 
'via' => $this->input->post('via'),
 
'tgl' => date('Y-m-d'),
 
//'bukti' => $upload_data['uploads']['file_name']
 
);

 
$this->db->insert('keuangan'$pendapatan);
 
$this->db->where('id_b_iuran'$id);
 
$this->db->insert('iuran'$data);
 
$this->session->set_flashdata('sukses','Iuran berhasil dibayarkan');
 
redirect('Panel_rt/iuran_rt/8');
 } 


terima kasih


RE: BAGAIMANA CARA MENGAMBIL DATA DARI HALAMAN SEBELUMNYA - mylastof - 02-04-2022

iuran.php itu dari controller apa?