Asslmkm mas robby saya punya kasus seperti ini
saya input data pada gambar 1 kemudian klik tombol save prosesnya jadi ke gambar 2 (alias jadi kosong), bagaimana supaya digambar 2 tadi ada data yang sudah di isi yang sama ?
berikut scriptnya dan gambar nya dibawah
//view
<?php
echo "<div class='col-md-12'>
<div class='box box-info'>
<div class='box-body'>";
$attributes = array('class'=>'form-horizontal','role'=>'form'); echo form_open_multipart('Layanan/tambah_pembayaran_baru',$attributes);
echo "<div class='col-md-12'>
<div class='box-header with-border'>
<h3 class='box-title'>DATA CUSTOMER SEBELUMNYA</h3>
</div>
<table class='table table-condensed table-bordered'>
<tbody>
<tr>
<th width='120px' scope='row'>Nama </th>
<td>
<input type='text' name='nama_jamaah' class='form-control' value='$customer[nama_depan] $customer[nama_tengah] $customer[nama_belakang]' readonly></td>
<input type='hidden' name='id_cus' class='form-control' value='$customer[id_cus]' readonly></td>
</tr>
<tr>
</tr>
<tr>
<th width='250px' scope='row'>Tempat/Tgl Lahir </th>
<td><input type='text' name='ttl' class='form-control' value='$customer[tempat_lahir] / $customer[tgl_lahir]' readonly></td>
</tr>
<tr>
<th width='250px' scope='row'>Kwitansi number</th>
<td><input type='text' name='no_order' class='form-control' value='$noautokwitansi' readonly></td>
</tr>
<tr>
<th width='120px' scope='row'>Harga</th>
<td><input type='text' name='harga_paket' class='form-control'></td>
<th width='120px' scope='row'>Qty</th>
<td><input type='text' name='qty' class='form-control'></td>
</tr>
<tr>
<th width='120px' scope='row'>Total bayar</th>
<td>
<input type='text' name='total_bayar' class='form-control'></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class='box-footer'>
<button type='submit' name='submit' class='btn btn-primary'>Save</button>
<a href='../tambah_pembayaran_baru'><button type='button' class='btn btn-default pull-right'>Cancel</button></a>
</div>
</div>";
?>
<div class='col-md-12'>
<div class='box box-info'>
<div class='box-header with-border'>
<h3 class='box-title'>Pembayaran Customer</h3>
</div>
<div class='box-body'>
<table class="table table-bordered">
<thead>
<tr>
<th>No</th>
<th>Nama</th>
<th>Harga</th>
<th>Total bayar</th>
<th>Sisa pembayaran</th>
<th>Status pembayaran</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
$no=1;
foreach($tampilkandata->result() as $getdata){
if ($getdata->sisa_pembayaran == 0){
$status = '<span style="color:green">LUNAS</span>';
}else{
$status = '<span style="color:red">BELUM LUNAS</span>';
}
?>
<tr>
<th><?php echo $no; ?></th>
<th><?php echo $getdata->nama_jamaah ?></th>
<td>
<?php cetakdulu
(number_format($getdata->harga_paket,0,",",".")) ?></td>
<td>
<?php cetakdulu
(number_format($getdata->jumlah_yang_dibayar,0,",",".")) ?></td>
<td>
<?php cetakdulu
(number_format($getdata->sisa_pembayaran,0,",",".")) ?></td>
<th><?php echo $status;?></th>
<th>
<center>
<a class='btn btn-success btn-xs' title='Invoice' href='#' onclick="cetak_invoice(<?php echo $getdata->id_pembayaran; ?>)"><span class='glyphicon glyphicon-print'></span></a>
<a class='btn btn-danger btn-xs delete-link' title='Delete Data' href='<?php echo base_url("Layanan/delete_pendaftaran/".$getdata->id_pembayaran)?>' ><span class='glyphicon glyphicon-remove'></span></a>
</center>
</th>
</tr>
<?php $no++;
}
?>
</tbody>
</table>
</div>
</div>
<script type="text/javascript">
function cetak_invoice(id) {
var url = "<?php echo site_url("Keuangan/cetak_invoice")?>/" + id;
var left = ($(window).width() / 2) - (1000 / 2);
var top = ($(window).height() / 2) - (1000 / 2);
window.open(url, "Cetak Invoice", "width=1000, height=600, top=" + top + ", left=" + left);
}
</script>
//controllers
function tambah_pembayaran_baru(){
cek_session_admin();
$id = $this->uri->segment(3);
$id_cus = $this->uri->segment(3);
if (isset($_POST['submit'])){
$this->model_main->updatepembayaran();
//$this->model_main->editdatacus($id)->row_array();
//$data['rows'] = $this->model_main->tampil_save($id)->row_array();
redirect('Layanan/tampilkandata');
//$data['jeniskelamin'] = $this->model_main->ambiljeniskelamin();
}else{
$data['customer'] = $this->model_main->editdatacus($id)->row_array();
//$data['jeniskelamin'] = $this->model_main->ambiljeniskelamin();
$data['tampilkandata'] = $this->model_main->datapernama($id_cus);
$data['noautokwitansi'] = $this->model_main->noautokwitansi();
$this->session->set_flashdata("pesan", "<div class=\"col-md-12\"><div class=\"alert alert-danger\" id=\"alert\">Gagal!!</div></div>");
$this->template->load('Cpanelweb/template','Cpanelweb/mod_keuangan/view_tampil_save',$data);
}
}
//model
public function updatepembayaran()
{
//'alamat'=>$this->db->escape_str($this->input->post('alamat')),
$id_cus = $this->db->escape_str(trim($this->input->post('id_cus')));
$nama_jamaah = $this->db->escape_str(trim($this->input->post('nama_jamaah')));
// $id_agent = $this->db->escape_str(trim($this->input->post('id_agent')));
$no_order = $this->db->escape_str(trim($this->input->post('no_order')));
$harga_paket = $this->db->escape_str(trim($this->input->post('harga_paket')));
$jumlah_yang_dibayar= $this->db->escape_str(trim($this->input->post('total_bayar')));
$qty= $this->db->escape_str(trim($this->input->post('qty')));
//if($jumlah_yang_dibayar > $harga_paket ){
//$this->session->set_flashdata('error', '<font color="#ff000">Maaf, anda kelebihan dana!!! silahkan input ulang</font>');
//echo $this->session->flashdata('error');
//exit;
//redirect('Keuangan/tambah_pembayaran');
//}
$note = $this->db->escape_str(trim($this->input->post('note')));
$sisapembayaran = $harga_paket*$qty-$jumlah_yang_dibayar;
$tanggal = date("Y-m-d");
$data = array(
'no_order' => $no_order,
'id_cus' => $id_cus,
'qty' => $qty,
'nama_jamaah' => $nama_jamaah,
// 'id_agent' => $id_agent,
'harga_paket' => $harga_paket,
'jumlah_yang_dibayar'=> $jumlah_yang_dibayar,
'waktu_pemesanan' => $tanggal,
'keterangan'=> $note,
'sisa_pembayaran' => $sisapembayaran
);
$this->db->insert('tbl_pembayaran',$data);
}