Daftar dan Belajar Sekarang!

Gimana caranya update statuspost gini ya? biar bisa dirubah dari viewny tanpa harus ke mysql

foto werich1
35 Kontribusi 1 Coto
2 bulan yang lalu
ane mau update post gan lewat edit admin tapi selalu ga masuk kenapa ya gan cuman balik2 eror engga cuman ga kerubah aja
<!-- Begin Page Content -->
        <div class="container-fluid">

            <!-- Page Heading -->
            <div class="d-sm-flex align-items-center justify-content-between mb-4">
                <h1 class="h3 mb-0 text-gray-800"><?= $title; ?></h1>
            </div>

            <!-- Content Row -->
            <div class="row">
                <div class="col-lg-8">
                    <?= form_open_multipart('admin/detailreq'); ?>
                    <div class="form-group row">
                        <label for="email" class="col-sm-2 col-form-label">Email</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" id="email" name="email" value="<?= $user['email']; ?>" readonly>
                        </div>
                    </div>
                    <div class="form-group row">
                        <label for="namaFes" class="col-sm-2 col-form-label">Nama Festival</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" id="email" name="email" value="<?= $postfes['namaFes']; ?>" readonly>
                        </div>
                    </div>
                    <div class="form-group row">
                        <label for="daerah" class="col-sm-2 col-form-label">Daerah Festival</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" id="daerah" name="daerah" value="<?= $postfes['nm_daerah']; ?>" readonly>

                        </div>
                    </div>
                    <div class="form-group row">
                        <label for="tanggal" class="col-sm-2 col-form-label">Tanggal</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" id="tanggal" name="tanggal" value="<?= $postfes['tanggal']; ?>" readonly>

                        </div>
                    </div>
                    <div class="form-group row">
                        <label for="tanggal2" class="col-sm-2 col-form-label">Tanggal</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" id="tanggal2" name="tanggal2" value="<?= $postfes['tanggal2']; ?>" readonly>

                        </div>
                    </div>
                    <div class="form-group row">
                        <label for="is_active" class="col-sm-2 col-form-label">Status Post</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" id="is_active" name="is_active" value="<?= $postfes['is_active']; ?>">

                        </div>
                    </div>

                    <div class="form-group row justify-content-end">
                        <div class="col-sm-10">
                            <button type="submit" class="btn btn-secondary">Edit</button>
                        </div>
                    </div>
                    </form>
                </div>
            </div>

        </div>
        <!-- /.container-fluid -->

        </div>
        <!-- End of Main Content -->
public function detailreq()
    {

        $data['user'] = $this->db->get_where('user', ['email' => $this->session->userdata('email')])->row_array();
        $data['title'] = 'Edit Post';

        $this->load->model('AdminModel', 'admin');
        $data['postfes'] = $this->admin->getDetailReq1();
        if ($this->form_validation->run() == false) {


            $this->load->view('templates/user-header', $data);
            $this->load->view('templates/user-sidebar', $data);
            $this->load->view('templates/user-topbar', $data);
            $this->load->view('admin/detailreq', $data);
            $this->load->view('templates/user-footer');
        } else {
            $active = $this->input->post('is_active');
            $email = $this->input->post('email');
            $id_p = $this->input->post('id_post');


            $this->db->set('is_active', $active);
            $this->db->where('email', $email);
            $this->db->where('id_post', $id_p);
            $this->db->update('postfes');
            $this->session->set_flashdata('message', '<div class="alert alert-success" role="alert">Congrats bout your new profile yo!</div>');
            redirect('user/mypost');
public function getDetailReq1()
    {
        $query = "SELECT `postfes`. * , `daerah`.`nm_daerah`
                    FROM `postfes` JOIN `daerah`
                    ON `postfes`.`daerah_id` = `daerah`.`id_daerah`
                    ";
        return $this->db->query($query)->row_array();
    }

Jawaban
foto mrizkiromdoni
75 Kontribusi 26 Coto
2 bulan yang lalu
Mohon di screen shoot errornya ?
  • error mah engga gan cuman dia ga ke ganti, malah balik setelah di pencet edit - werich1

foto werich1
35 Kontribusi 1 Coto
2 bulan yang lalu
error mah engga gan cuman datany doang ga keganti

foto werich1
35 Kontribusi 1 Coto
2 bulan yang lalu
help gimana caranya ya wkwk bingung dah ganti2 ko ga ke ganti di databsenya

foto Terra
38 Kontribusi 20 Coto
2 bulan yang lalu
Coba cek diview gan, klau saya nggk salah.. input dengan name id_post nya nggk ad gan, soalnya lagi buka dari hp


Login untuk diksusi di forum sekolah koding