Postingan lainnya
Gk bisa edit form pake codeigniter
Gan permisi mau nnya kenapa yah saya gk bisa edit form didalam website sekolah buatan saya
Kodingan front end
<div class="col-sm-9 col-sm-offset-3 col-lg-10 col-lg-offset-2 main">
<div class="row">
<ol class="breadcrumb">
<li><a href="#">
<em class="fa fa-home"></em>
</a></li>
<li class="active">Edit Nilai</li>
</ol>
</div>
<?php if ($this->session->flashdata('success')) : ?>
<div class="alert alert-success" role="alert">
<?php echo $this->session->flashdata('success'); ?>
</div>
<?php endif; ?>
<div class="container-fluid">
<div class="panel-button-tab-left">
<form method="post" action="<?php echo base_url(). 'guru/nilai'?>">
<button class="btn btn-primary" id="submit-buttons" type="submit" >List Nilai</button>
</form>
</div><br>
<form action="<?php echo base_url("Guru/nilaiEdit/$nilai->id_nilai") ?>" method="post" enctype="multipart/form-data">
<input type="hidden" name="id_nilai" value="<?php echo $nilai->id_nilai?>">
<div class="col-md-8">
<div class="form-group">
<label for="id_siswa">Id Siswa :</label>
<input type="text" class="form-control" name="nama_siswa" value="<?php echo $nilai->id_siswa ?>">
</div>
</div>
<div class="col-md-8">
<div class="form-group">
<label for="id_kelas">Id Kelas :</label>
<input type="text" class="form-control" name="id_kelas" value="<?php echo $nilai->id_kelas ?>">
</div>
</div>
<div class="col-md-8">
<div class="form-group">
<label for="id_mapel">Id Mapel :</label>
<input type="text" class="form-control" name="id_mapel" value="<?php echo $nilai->id_mapel ?>">
</div>
</div>
<div class="col-md-8">
<div class="form-group">
<label for="id_mapel">uh_1 :</label>
<input type="text" class="form-control" name="uh_1" value="<?php echo $nilai->uh_1 ?>">
</div>
</div>
<div class="col-md-8">
<div class="form-group">
<label for="id_mapel">uh_2 :</label>
<input type="text" class="form-control" name="uh_2" value="<?php echo $nilai->uh_2 ?>">
</div>
</div>
<div class=col-md-12>
<button type="submit" class="btn btn-primary" value="simpan">Simpan</button>
<button type="reset" class="btn btn-danger">Reset</button>
</div>
</form>
</div>
</div>
Kodingan back end
<?php defined('BASEPATH') or exit('No direct script access allowed');
class Model_nilai extends CI_Model
{
private $_table = "nilai";
public $id_nilai;
public $id_guru;
public $id_siswa;
public $id_kelas;
public $id_mapel;
public $uh_1;
public $uh_2;
public $uh_3;
public $uh_4;
public $uh_5;
public $uh_6;
public $uh_7;
public $uh_8;
public $uts;
public $uas;
public $id_semester;
public function rules()
{
return [
[
]
];
}
public function getAll()
{
return $this->db->get($this->_table)->result();
}
public function getById($id_nilai)
{
return $this->db->get_where($this->_table, ["id_nilai" => $id_nilai])->row();
}
public function update()
{
$post = $this->input->post();
// var_dump($post);
$this->id_nilai = $post["id_nilai"];
$this->id_guru = $post["id_guru"];
$this->id_siswa =$post["id_siswa"];
$this->id_kelas =$post["id_kelas"];
$this->id_mapel =$post["id_mapel"];
$this->uh_1 = $post["uh_1"];
$this->uh_2 = $post["uh_2"];
$this->uh_3 = $post["uh_3"];
$this->uh_4 = $post["uh_4"];
$this->uh_5 = $post["uh_5"];
$this->uh_6 = $post["uh_6"];
$this->uh_7 = $post["uh_7"];
$this->uh_8 = $post["uh_8"];
$this->uts = $post["uts"];
$this->uas = $post["uas"];
$this->id_semester =$post["id_semester"];
$this->db->update($this->_table, $this, array("id_nilai" => $post["id_nilai"]));
}
public function delete($id_nilai)
{
return $this->db->delete($this->_table, array("id_nilai" => $id_nilai));
}
public function save()
{
$post = $this->input->post();
// var_dump($post);
// $this->id_nilai = $post["id_nilai"];
$this->id_guru = $post["id_guru"];
$this->id_siswa =$post["id_siswa"];
$this->id_kelas =$post["id_kelas"];
$this->id_mapel =$post["id_mapel"];
$this->uh_1 = $post["uh_1"];
$this->uh_2 = $post["uh_2"];
$this->uh_3 = $post["uh_3"];
$this->uh_4 = $post["uh_4"];
$this->uh_5 = $post["uh_5"];
$this->uh_6 = $post["uh_6"];
$this->uh_7 = $post["uh_7"];
$this->uh_8 = $post["uh_8"];
$this->uts = $post["uts"];
$this->uas = $post["uas"];
$this->id_semester =$post["id_semester"];
$this->db->insert($this->_table, $this);
}
}
0