php - input data codeigniter always 0 on database -


i new codeigniter. found problem. have read on codeigniter form sends '0' data , zero (0 ) database result in codeigniter did not help. problem data in database 0.

my add view code

<form method="post">         <div class="form-inline form-group">         <label for="kegiatan">kegiatan : </label>         <select class="form-control" id="disableselect" disabled><option>mpab</option></select> <!-- inget ganti pake id terakhir -->     </div>                <div class="form-group">         <label for="indikator">indikator : </label>                 <input type="text" name="indikator" id="indikator" placeholder="indikator" class="form-control"> <!-- kosongin, tapi kalo edit munculin indikator yang di edit -->         </div>          <div class="form-group">         <a href="<?= base_url() ?>ipmpab/addipmpabdb/" class="btn btn-success"><span class='glyphicon glyphicon-plus'></span> add</a>     </div>     </form> 

my controller

        public function addipmpabdb() {     if ($this->form_validation->run()==true){         $tambah = array (                 'indikator' =>$this->input->post('indikator'),                 'id_jk'=>1     );             $this->tb_det_penilaian->addindikator($tambah);     redirect("ipmpab");     } 

my model

    function addindikator($tambah) {     $this->db->insert('tb_det_penilaian', $tambah); } 

you don't have valid submit button in html code. remove link , use input type "submit" or button

replace :

<div class="form-group">     <a href="<?= base_url() ?>ipmpab/addipmpabdb/" class="btn btn-success">         <span class='glyphicon glyphicon-plus'></span> add     </a> </div> 

with :

<div class="form-group">     <button type="submit" class="btn btn-success">         <span class='glyphicon glyphicon-plus'></span>add      </button> </div>    

... exemple

then add action attribute form :

<form method="post" action="<?= site_url('ipmpab/addipmpabdb'); ?>"> 

Comments

Popular posts from this blog

How to run C# code using mono without Xamarin in Android? -

c# - SharpSsh Command Execution -

python - Specify path of savefig with pylab or matplotlib -