0
<tr><th>Option Subject</th>
 <th>
<input type="checkbox" name="skills" id="skills[]" value="C++"> C++<br>
<input type="checkbox" name="skills" id="skills[]" value="JAVA"> JAVA<br>
<input type="checkbox" name="skills" id="skills[]" value="HTML"> HTML<br>
<input type="checkbox" name="skills" id="skills[]" value="PHP"> PHP<br>
<input type="checkbox" name="skills" id="skills[]" value="ASP.NET">ASP.NET<br>
<font color="#FF0000"><?php echo form_error('skills');?></font>
 </th>
</tr>

controler public function insert() { $skills=$this->form_validation->set_rules('skills', 'Option Subject','required');

$data = array(
    'skills' => implode(",", $skills);       
);
}



if(isset($options['skills'])) 
 $this->db->set('skills',($options['skills']));  
 $this->db->insert("regi_user");  
 return $this->db->insert_id();  

2 Answers 2

0

You have to convert imploded value to string.

Try the following code

 $data = array(
        'skills' => json_encode(implode(",", $skills));       
    );

    $this->db->insert("regi_user");  
    return $this->db->insert_id();  
Sign up to request clarification or add additional context in comments.

1 Comment

Not Work @Roshni
0

To add multiple value in table try following code.

$language = $this->input->post('skills');

if (is_array($language) && !empty($language))
{
    foreach($language as $lan)
    {
        $insert['language'] = $lan;
        $this->db->insert("table name");
    }
}

1 Comment

Contoller public function insert() { $skills=$this->form_validation->set_rules('skills', 'Option Subject','required'); How to insert Multiple value in database

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.