输入post在实时服务器上测试时返回null

I have a form sent to ajax, it works fine in localhost, but it gives me error when uploaded to server : error at line 29 in model/Excel.php. This is the line 29 $this->db->insert('update',$data_user)

I cannot find the mistake. Please help..

A Database Error Occurred

Error Number: 1062

Duplicate entry '0' for key 'PRIMARY'

INSERT INTO `request` (`email`, `name`, `phone`, `status`, `filename_user`) VALUES ([email protected]', 'tes email', '436354', '0', '5760c25d7fa87.xlsx')

Filename: models/Excel.php

Line Number: 29

Excel models :

function tambahuser($data_user)
{
  $this->db->insert('request', $data_user);
  $this->db->insert_id();
            
  foreach ($data_user as $key)     
  {  
   $data = array(
     'email'  =>   $this->input->post('email'),
     'from_name'  =>   $this->input->post('from_nama'),
     'from_phone' =>   $this->input->post('from_phone')
   );
  }
}

The controller :

function undangan()
    {
        $this->load->library('session');
            $email          =   $this->input->post('email');
            $from_nama      =   $this->input->post('from_nama');
            $from_phone     =   $this->input->post('from_phone');

            $data_user = array(

                'email' => $email,
                'name'  => $from_nama,
                'phone' => $from_phone,
                'status'=> '0',
                'filename_user' => $this->session->xls, //upload filename
                );

            $this->load->model('excel');
            
            $this->excel->tambahuser($data_user);
            $this->load->library('email_ses');
            $this->email_ses->send();
            
            
        echo json_encode(array("email" => $email, "from_nama" => $from_nama,"from_phone" => $from_phone ));
    } 
}

The form :

<h4 id="form">Data Personal</h4>
<div class="col-sm-4">
   <input type="email" class="form-control input-lg" id="email"  name="email"  placeholder="Email" required>
</div>

<div class="col-sm-4">
   <input type="text" class="form-control input-lg"  id="from_nama" name="from_nama" placeholder="Nama" required>
</div>

<div class="col-sm-4">
   <input type="number" class="form-control input-lg"  id="from_phone"  name="from_phone" placeholder="Phone" required>
</div>
                            
<div class="row" id="button_pesan" align="center" style="display: none;">
  <button id="pesan" type="button" class="btn btn-download btn-md" onclick=pesan()>
     <span class="glyphicon glyphicon-send" aria-hidden="true" ></span>Pesan
  </button>
</div>

Ajax function :

function pesan()
    { 
        email = $("#email").val(); 
        from_nama = $("#from_nama").val(); 
        from_phone = $("#from_phone").val(); 

        $.ajax
        ({
            url : "<?php echo site_url('kirim/undangan')?>/",
            type: "POST",
            dataType: "text",
            data:{from_nama: from_nama, email: email, from_phone: from_phone},
            success: function(data)
            {       
               $('#alert_sukses').show();
               $('#form_pesan').hide();
               $('#myModalLabel').hide();
               
            },
            error: function (jqXHR, textStatus, errorThrown)
            {
                alert('Error upload data');
            }

        });
    }

Table request structure :

enter image description here

</div>