I want to ask how to enter the same input values in one column
public function token()
{
$cart = ConfigServices::cart();
$nama_produk = explode(",", $this->request->getVar('nama_produk'));
$kurir = $this->request->getVar('Kurir');
$ServiceKurir = $this->request->getVar('Servis');
$nama = $this->request->getVar('nama');
$nama_penerima = $this->request->getVar('nama_penerima');
$email = $this->request->getVar('email');
$phone = $this->request->getVar('phone');
$provinsi = $this->request->getVar('id');
$kabupaten = $this->request->getVar('Kabupaten');
$address = $this->request->getVar('alamat');
$total = $this->request->getVar('total_harga');
$id_transaksi = time();
foreach ($cart->contents() as $key => $value) {
$name = $value['name'];
}
$params = array(
'transaction_details' => array(
'order_id' => $id_transaksi,
'gross_amount' => $total,
),
'customer_details' => array(
'first_name' => $nama,
'email' => $email,
'phone' => $phone,
),
);
$snapToken = MidtransSnap::getSnapToken($params);
$data = [
'id_transaksi' => $id_transaksi,
'email' => $email,
'nama_produk' => implode("", $nama_produk),
'nama' => $nama,
'nama_penerima' => $nama_penerima,
'alamat' => $address,
'phone' => $phone,
'total_harga' => $total,
'kurir' => $kurir,
'method' => $ServiceKurir,
'token' => $snapToken
];
$this->transaksi->save($data);
}
this is my controller
<form action="<?= base_url('/payment/midtrans') ?>" method="post" id="payment-form">
<div class="container mt-5">
<div class="row">
<label for="nama_produk"></label>
<div class="form-floating">
<?php foreach ($cart->contents() as $key => $value) : ?>
<input type="hidden" name="nama_produk" id="nama_produk" class="form-control" value="<?= $value['name']; ?>" required>
<?php endforeach ?>
</div>
</div>
</div>
<div class="container mt-3">
<div class="row">
<label for="total_berat"></label>
<div class="form-group">
<?php $total_berat = 0; ?>
<?php foreach ($cart->contents() as $key => $value) : ?>
<?php $total_berat = ($value['options']['berat'] * $value['qty']) + $total_berat ?>
<?php endforeach ?>
<input type="hidden" name="total_berat" class="form-control" id="total_berat" value="<?= $total_berat ?>" readonly>
</div>
</div>
</div>
<input type="hidden" name="result_type" id="result-type" value="">
<input type="hidden" name="result_data" id="result-data" value="">
<div class="d-print-none mt-4">
<div class="float-end">
<button class="btn btn-success me-1" id="pay-button"> Buat Tagihan</button>
</div>
</div>
</div>
</div>
</form>
this is my view
this is the result of input
What I hope is that the product name column matches the example input as in the image below
this is my view
this is the result of input
What I hope is that the product name column matches the example input as in the image below