Input satu data, semua data jadi ikut ke input di DB

jadi saya ada kendala di bagian upload bukti booking, yang di mana USER A upload bukti, tapi USER B.C.D nya ngikut ke upload bukti bookingnya,

berikut codingan controlnya

public function pembayaran_aksi()
{
 $id                                 = $this->input->post('id_sewa',true);
 $bukti_pembayaran                   = $_FILES['bukti_pembayaran']['name'];
 if($bukti_pembayaran){
   $config ['upload_path']         ='./assets/upload/bukti';
   $config ['allowed_types']       ='pdf|jpg|jpeg|png|tiff';

   $this->load->library('upload', $config);

   if($this->upload->do_upload('bukti_pembayaran')){
   $bukti_pembayaran=$this->upload->data('file_name');
   $this->db->set('bukti_pembayaran', $bukti_pembayaran);
   }else{
   echo $this->upload->display_errors();
   }
  }
   $data   =   array(
   'bukti_pembayaran'      =>$bukti_pembayaran,
    );
    $wheree =   array(
    'id_sewa'             =>$id
    );
    $this->barang_model->update_data('transaksi', $data, $where);
    $this->session->set_flashdata('pesan','<div class="alert alert-success alert-dismissible fade show" role="alert">
      Bukti Permbayaran anda berhasil diUpload !
      <button type="button" class="close" data-dismiss="alert" aria-label="Close">
      <span aria-hidden="true">&times;</span>
      </button></div>');
      redirect('custamer/transaksi');
   }

viewnya

<?php
                        if (empty($tr->bukti_pembayaran)) { ?>
                            <button style="width:100%" type="button" class="btn btn-sm btn-danger"
                                data-toggle="modal" data-target="#exampleModal"> Upload Bukti Pembayaran
                            </button>
                    <?php }elseif ($tr->status_pembayaran =='0') { ?>
                        <button style="width:100%" type="button" class="btn btn-sm btn-warning">
                        <i class="fa fa-hourglass" aria-hidden="true"></i> Menunggu Konfirmasi</button>
                    <?php } elseif ($tr->status_pembayaran =='1') { ?>
                            <button style="width:100%" type="button" class="btn btn-sm btn-success">
                            <i class="fa fa-check"></i> Proses Booking Selesai</button>
                    <?php } ?>
                </div>
            </div>
        </div>
    </div>
</div>

<!-- Modal -->
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title" id="exampleModalLabel">Upload Bukti pembayaran Anda</h5>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                <span aria-hidden="true">&times;</span>
                </button>
            </div>
            <form method="POST" action="<?php echo base_url('custamer/transaksi/pembayaran_aksi')?>" enctype="multipart/form-data">
                <div class="modal-body">
                    <div class="form-group">
                        <label>Upload Bukti Pembayaran</label>
                        <input type="hidden" name="id_sewa" class="form-control" value="<?php echo $tr->id_sewa?>">
                        <input type="file" name="bukti_pembayaran" class="form-control">
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="submit" class="btn btn-primary">Kirim</button>
                </div>
            </form>
        </div>
    </div>
</div>
avatar Loa2nd
@Loa2nd

2 Kontribusi 0 Poin

Diperbarui 4 tahun yang lalu

1 Jawaban:

<div>Try this fam:<br><br></div><pre>&lt;?php if(empty($tr-&gt;bukti_pembayaran)): ?&gt;

&amp;lt;button style=&quot;width:100%&quot; type=&quot;button&quot; class=&quot;btn btn-sm btn-danger&quot; 
	data-toggle=&quot;modal&quot; data-target=&quot;#exampleModal&quot;&amp;gt; Upload Bukti Pembayaran
&amp;lt;/button&amp;gt;

&lt;?php else: ?&gt;

&amp;lt;?php if ($tr-&amp;gt;status_pembayaran ==&#039;0&#039;) :?&amp;gt;

	&amp;lt;button style=&quot;width:100%&quot; type=&quot;button&quot; class=&quot;btn btn-sm btn-warning&quot;&amp;gt;
	&amp;lt;i class=&quot;fa fa-hourglass&quot; aria-hidden=&quot;true&quot;&amp;gt;&amp;lt;/i&amp;gt; Menunggu Konfirmasi&amp;lt;/button&amp;gt;

&amp;lt;?php else: ?&amp;gt;

	&amp;lt;button style=&quot;width:100%&quot; type=&quot;button&quot; class=&quot;btn btn-sm btn-success&quot;&amp;gt;
	&amp;lt;i class=&quot;fa fa-check&quot;&amp;gt;&amp;lt;/i&amp;gt; Proses Booking Selesai&amp;lt;/button&amp;gt;

&amp;lt;?php endif ?&amp;gt;

&lt;?php endif ?&gt;</pre>

avatar anggitpy
@anggitpy

4 Kontribusi 1 Poin

Dipost 4 tahun yang lalu

Login untuk ikut Jawaban