Postingan lainnya
Gagal ambil session
if ($this->form_validation->run() == false) {
$this->load->view('templates/header', $data);
$this->load->view('templates/sidebar', $data);
$this->load->view('templates/topbar', $data);
$this->load->view('form/index', $data);
$this->load->view('templates/footer');
$this->load->view('form/index_vitamin');
} else {
$data = [
'date' => $date,
'time' => $time,
'name' => $_SESSION['name'],
'prener' => $_SESSION['id_prener'],
'layanan' => $_SESSION['layanan'],
'trackid' => htmlspecialchars($this->input->post('trackid', true)),
'chanel' => htmlspecialchars($this->input->post('chanel', true)),
'regional' => htmlspecialchars($this->input->post('regional', true)),
'witel' => htmlspecialchars($this->input->post('witel', true)),
'validation' => htmlspecialchars($this->input->post('validation', true)),
'detail_invalid' => htmlspecialchars($this->input->post('invalid', true)),
'ktp_validation' => htmlspecialchars($this->input->post('ktp_validation', true)),
'detail_ktp' => htmlspecialchars($this->input->post('detail_ktp', true)),
'dial_to' => htmlspecialchars($this->input->post('dialto', true)),
'status_call' => htmlspecialchars($this->input->post('statuscall', true)),
'reason_call' => htmlspecialchars($this->input->post('reasoncall', true)),
'data_type' => htmlspecialchars($this->input->post('type_data', true)),
print_r($_SESSION)
];
$this->db->insert('form_data', $data);
$this->session->set_flashdata('message', '<div class="alert alert-transparent text-center" role="alert">New Data has been added...
</div>');
//kembali ke halaman awal
redirect('form');
}
A PHP Error was encountered
Severity: Notice
Message: Undefined index: layanan
Filename: controllers/Form.php
Line Number: 104
Backtrace:
File: C:\xampp\htdocs\mandaa\application\controllers\Form.php
Line: 104
Function: _error_handler
File: C:\xampp\htdocs\mandaa\index.php
Line: 315
Function: require_once
kenapa gagal ambil session layanan yah
1 Jawaban:
<div>coba gunakan library session, nanti untuk membuat sessionnya :</div><pre>$this->session->set_userdata("nama session", "isi session")</pre><div><br>dan untuk memanggilnya :</div><pre>$this->session->userdata("nama session")</pre><div><br>kalau ada salah penulisan syntax coba perbaiki sendiri saja, karena saya juga sudah cukup lupa dengan codeigniter 3, soalnya sekarang sudah ada codeigniter 4 </div>