error Too few arguments to function Balita::edit()

controller

public function edit($idStunting)
    {
        $this->form_validation->set_rules('nama', 'Nama Balita', 'required', array(
            'required' => '%s harus diisi'
        ));

        $this->form_validation->set_rules('jenkel', 'jenis kelamin', 'required', array(
            'required' => '%s harus diisi'
        ));

        $this->form_validation->set_rules('tgl_lahir', 'Tanggal lahir', 'required', array(
            'required' => '%s harus diisi'
        ));

        $this->form_validation->set_rules('alamat', 'Alamat', 'required', array(
            'required' => '%s harus diisi'
        ));

        $this->form_validation->set_rules('latitudeStunting', 'Latitude', 'required', array(
            'required' => '%s harus diisi'
        ));

        $this->form_validation->set_rules('longitudestunting', 'Longitude', 'required', array(
            'required' => '%s harus diisi'
        ));

        if ($this->form_validation->run() ==FALSE) {
            $data = array(
                'title' => 'Edit Data Balita',
                'balita'=> $this->m_balita->detail($idStunting),
                'isi'   => 'v_editbalita'
                );
        
                $this->load->view('layout/v_wrapper', $data, FALSE);
        }else{
            $data = array(
                'idStunting'       =>$idStunting,
                'nama'             =>$this->input->post('nama'),
                'jenkel'           =>$this->input->post('jenkel'),
                'tgl_lahir'        =>$this->input->post('tgl_lahir'),
                'alamat'           =>$this->input->post('alamat'),
                'latitudeStunting' =>$this->input->post('latitudeStunting'),
                'longitudestunting'=>$this->input->post('longitudestunting'),
            );
            $this->m_balita->edit($data);
            $this->session->set_flashdata('pesan', 'data berhasil di edit');
            redirect('balita');

        }

    }

model

 public function detail($idStunting)
    {
        $this->db->select('*'); 
        $this->db->from('stunting'); 
        $this->db->where('idStunting', '$idStunting');
        return $this->db->get()->row();
    }

    public function edit($data)
    {
        $this->db->where('idStunting', $data['idStunting']);
        $this->db->update('stunting', $data);

view

<div class="col-sm-5">
    <div class="panel panel-primary">
        <div class="panel-heading">
            Input Data
        </div>
        <div class="panel-body">
            <?php 
            /* validasi data tidak boleh */
                echo validation_errors('<div class="alert alert-danger alert-dismissable">
                <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>','</div>');
                
                /* notifikasi pesan data berhasil di simpan */
                if ($this->session->flashdata('pesan'))
                {
                    echo '<div class="alert alert-success alert-dismissable">
                    <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>';

                    echo $this->session->flashdata('pesan');
                    echo '</div>';
                }
                echo form_open('balita/edit');
            ?>

            <div class="form-group">
                <label>Nama Balita</label>
                <input name="nama" placeholder="Nama Balita" value="<?= set_value('nama')?>" class="form-control" />
            </div>

            <div class="form-group">
                <label>Jenis Kelamin</label>
                <input name="jenkel" placeholder="Jenis Kelamin" value="<?= set_value('jenkel')?>" class="form-control" />
            </div>

            <div class="form-group">
                <label>Tanggal Lahir</label>
                <input name="tgl_lahir" placeholder="Tanggal Lahir" value="<?= set_value('tgl_lahir')?>" class="form-control" />
            </div>

            <div class="form-group">
                <label>Alamat</label>
                <input name="alamat" placeholder="Alamat" value="<?= set_value('alamat')?>" class="form-control" />
            </div>

            <div class="form-group">
                <label>Latitude</label>
                <input id="Latitude" name="latitudeStunting" placeholder="Latitude" 
                value="<?= set_value('latitudeStunting')?>" class="form-control" readonly  />
                
            </div>

            <div class="form-group">
                <label>Longitude</label>
                <input id="Longitude" name="longitudestunting" placeholder="Longitude" 
                value="<?= set_value('longitudestunting')?>" class="form-control" readonly />
            </div>

            <div class="form-group">
                <label></label>
                <button type="submit" class="btn btn-sm btn-success">Reset</button>
                <button type="submit" class="btn btn-sm btn-primary">Simpan</button>
            </div>

            <?php echo form_close();?>                
        </div>
                        
    </div>
</div>
avatar niningajh29
@niningajh29

1 Kontribusi 0 Poin

Dipost 10 bulan yang lalu

Belum ada Jawaban. Jadi yang pertama Jawaban

Login untuk ikut Jawaban