Hi everybody,
I'm using CodeIgniter framework. I use checkboxes for student_type, lecturer_type and user_type, but it can't insert in my DB table. They must be inserted in 3 different table columns.
My form is:

<form>
  <input type='checkbox' name="student_type" value='0'>Student
            <input type='checkbox' name="user_type" value='1'>Customer
             <input type='checkbox' name="lecturer_type" value='2'>Lecturer
             </form>

And my code for inserting data is:

 public function registrate()
    {
      $data=array(
       'user_info'=>$this->input->post('user_info'),
            'user_type'=>$this->input->post('user_type'),
            'student_type'=>$this->input->post('student_type'),
            'lecturer_type'=>$this->input->post('lecturer_type')
                );
                 $user=$this->db->insert('users',$data);

        return $user;

I made it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.