Postingan lainnya
Kenapa variablenya ga ada isinya ?
ini untuk modelnya
public function get_data_persetujuan()
{
$this->db->select('tbl_persetujuan.kd_persetujuan, tbl_permohonan.no_permohonan, tbl_training.judul_training, tbl_training.penyelenggara, tbl_training.tempat, tbl_training.biaya, tbl_training.tujuan, tbl_karyawan.nm_karyawan, tbl_persetujuan.persetujuan, tbl_persetujuan.keterangan');
$this->db->from('tbl_persetujuan');
$this->db->join('tbl_permohonan','tbl_persetujuan.no_permohonan=tbl_permohonan.no_permohonan');
$this->db->join('tbl_training','tbl_persetujuan.id_training=tbl_training.id_training');
$this->db->join('tbl_karyawan','tbl_persetujuan.nrp=tbl_karyawan.nrp');
$query = $this->db->get();
return $query;
}
ini controllernya
public function persetujuan()
{
$ceks = $this->session->userdata('kamar@2017');
if(!isset($ceks)) {
redirect('web/login');
}else{
$data['user'] = $this->Mcrud->get_data_by_pk('tbl_user', 'username', $ceks);
$data['v_persetujuan'] = $this->Mcrud->get_data_persetujuan();
$this->load->view('header', $data);
$this->load->view('director/persetujuan', $data);
$this->load->view('footer');
if (isset($_POST['btnsimpan'])) {
$no_permohonan = htmlentities(strip_tags($_POST['no_permohonan']));
$id_training = htmlentities(strip_tags($_POST['id_training']));
$nrp = htmlentities(strip_tags($_POST['nrp']));
$persetujuan = htmlentities(strip_tags($_POST['persetujuan']));
$keterangan = htmlentities(strip_tags($_POST['keterangan']));
$data = array(
'no_permohonan' => $no_permohonan,
'id_training' => $id_training,
'nrp' => $nrp,
'persetujuan' => $persetujuan,
'keterangan' => $keterangan
);
$this->Mcrud->save_data('tbl_persetujuan', $data);
$this->session->set_flashdata('msg',
'
<div class="alert alert-success alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">× </span>
</button>
<strong>Sukses!</strong> persetujuan berhasil ditambahkan.
</div>'
);
}else{
$error = $this->upload->display_errors();
$this->session->set_flashdata('msg',
'
<div class="alert alert-warning alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">× </span>
</button>
<strong>Gagal!</strong> '.$error.'.
</div>'
);
}
redirect('web/persetujuan');
}
}
ini viewnya
<?php
$ceks = $this->session->userdata('kamar@2017');
$ceks = $this->Mcrud->get_data_by_pk('tbl_user', 'username', $ceks)->row();
//var_dump($v_persetujuan->result_array());exit;
?>
<!-- Main content -->
<div class="content-wrapper">
<br><br><br>
<!-- Content area -->
<div class="content">
<!-- Dashboard content -->
<div class="row">
<!-- Basic datatable -->
<div class="panel panel-flat">
<div class="panel-heading">
<h5 class="panel-title">
<?php
if ($ceks->level == "director") {?>
Permohonan Training
<?php
} ?> (Persetujuan Director)</h5>
<div class="heading-elements">
<ul class="icons-list">
<li><a data-action="collapse"></a></li>
</ul>
</div>
</div>
<hr>
<div class="panel-body">
<?php
echo $this->session->flashdata('msg');
?>
<?php
if ($ceks->level == "director") {?>
<form class="form-horizontal" action="" method="post">
<div class="col-md-12">
<div class="col-md-12">
<div class="form-group">
<label class="control-label col-lg-2">No Permohonan</label>
<div class="col-lg-3">
<select class="form-control" name="no_permohonan" onchange="changeValue(this.value)" autofocus>
<option value="">Pilih No Permohonan</option>
<?php
$jsArray = "var dtKamar = new Array();\n";
foreach ($v_persetujuan->result() as $baris) {
echo '<option value="' . $baris->no_permohonan . '">' . "$baris->no_permohonan [$baris->no_permohonan]" . '</option>';
$jsArray .= "dtKamar['" . $baris->no_permohonan . "'] = {
id_training:'" . addslashes($baris->id_training) . "'
};\n";
} ?>
</select>
<script type="text/javascript">
<?php echo $jsArray; ?>
function changeValue(id){
document.getElementById('id_training').value = dtKamar[id].id_training;
};
</script>
</div>
</div>
<div class="form-group">
<label class="control-label col-lg-2">ID Training</label>
<div class="col-lg-10">
<input type="text" name="id_training" id="id_training" class="form-control" value="" required maxlength="35" placeholder="ID Training" readonly>
</div>
</div>
<!-- ini space untuk nrp -->
<div class="form-group">
<label class="control-label col-lg-2">NRP</label>
<div class="col-lg-10">
<input type="text" name="nrp" id="nrp" class="form-control" value="" required maxlength="5" placeholder="NRP" >
</div>
</div>
<div class="form-group">
<label class="control-label col-lg-2">Persetujuan</label>
<div class="col-lg-10">
<input type="radio" name="gender" class="form-control" value="Setuju" required> Setuju<br>
<input type="radio" name="gender" class="form-control" value="Tidak" required> Tidak Setuju<br>
</div>
</div>
<div class="form-group">
<label class="control-label col-lg-2">Keterangan</label>
<div class="col-lg-10">
<textarea name="keterangan" rows="8" cols="80" class="form-control" placeholder="Keterangan" required></textarea>
</div>
</div>
</div>
</div>
<br>
<hr>
<button type="submit" name="btnsimpan" class="btn btn-primary" style="float:right;">Simpan</button>
</form>
</div>
<br>
<hr>
<?php
} ?>
<div class="table-responsive">
<table class="table datatable-basic" width="100%">
<thead>
<th width="10">No</th>
<th>No Permohonan</th>
<th>Id Training</th>
<th>Judul Training</th>
<th>Penyelenggara</th>
<th>Tempat</th>
<th>Waktu</th>
<th>Biaya</th>
<th>Tujuan</th>
<th>Tanggal Permohonan</th>
<th>NRP</th>
<th>Nama Karyawan</th>
<th>Departmen</th>
<th>Seksi</th>
<th>Golongan</th>
<th>Jabatan</th>
<th>Persetujuan</th>
<th>Keterangan</th>
<?php
if ($ceks->level == "director") {?>
<th class="text-center" width="100"></th>
<?php
} ?>
</thead>
<tbody>
<?php
$no = 1;
foreach ($v_persetujuan ->result() as $baris) {
?>
<tr>
<td><?php echo $no.'.'; ?></td>
<td><?php echo $baris->no_permohonan; ?></td>
<td><?php echo $baris->judul_training; ?></td>
<td><?php echo $baris->penyelenggara; ?></td>
<td><?php echo $baris->tempat; ?></td>
<td><?php echo $baris->waktu; ?></td>
<td><?php echo $baris->biaya; ?></td>
<td><?php echo $baris->tujuan; ?></td>
<td><?php echo $baris->tgl_permohonan; ?></td>
<td><?php echo $baris->nm_karyawan;?></td>
<td><?php echo $baris->dept; ?></td>
<td><?php echo $baris->seksi; ?></td>
<td><?php echo $baris->gol; ?></td>
<td><?php echo $baris->jab; ?></td>
<td><?php echo $baris->persetujuan; ?></td>
<td><?php echo $baris->keterangan; ?></td>
<?php
if ($ceks->level == "director") {?>
<td>
<a href="web/persetujuan_edit/<?php echo $baris->kd_persetujuan; ?>" title="Edit"><span class="icon-pencil"></span></a>
<a href="web/persetujuan_hapus/<?php echo $baris->kd_persetujuan; ?>" title="Hapus" onclick="return confirm('Apakah Anda yakin?')"><span class="icon-trash"></span></a>
</td>
<?php
} ?>
</tr>
<?php
$no++;
} ?>
</tbody>
</table>
</div>
</div>
<!-- /basic datatable -->
</div>
<!-- /dashboard content -->
Kenapa hasil loadnya
This page isn’t working localhost redirected you too many times. Try clearing your cookies. ERR_TOO_MANY_REDIRECTS
1
2 Jawaban:
Jawaban Terpilih
errornya:This page isn’t working localhost redirected you too many times., ERR_TOO_MANY_REDIRECTS
artinya dia redirect berkali kali ngga ada ujungnya. Cek lagi if else kamu yang bagian redirect pastikan sesuai yang kamu mau, jangan sampai dia redirect berulang-ulang ngga habis habis
2
Tanggapan
ka gimana aku masih ga paham
Solved! thank you ka, ku jadi paham tentang kesalahan ini
1