Postingan lainnya
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">×</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">×</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>
0
1 Jawaban:
<div>Try this fam:<br><br></div><pre><?php if(empty($tr->bukti_pembayaran)): ?>
&lt;button style="width:100%" type="button" class="btn btn-sm btn-danger"
data-toggle="modal" data-target="#exampleModal"&gt; Upload Bukti Pembayaran
&lt;/button&gt;
<?php else: ?>
&lt;?php if ($tr-&gt;status_pembayaran =='0') :?&gt;
&lt;button style="width:100%" type="button" class="btn btn-sm btn-warning"&gt;
&lt;i class="fa fa-hourglass" aria-hidden="true"&gt;&lt;/i&gt; Menunggu Konfirmasi&lt;/button&gt;
&lt;?php else: ?&gt;
&lt;button style="width:100%" type="button" class="btn btn-sm btn-success"&gt;
&lt;i class="fa fa-check"&gt;&lt;/i&gt; Proses Booking Selesai&lt;/button&gt;
&lt;?php endif ?&gt;
<?php endif ?></pre>
0