SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Jan 2013
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    can't Display multiple checkbox value in codeignetor

    Hi,I can't display Multiple checkbox save value in my veiw page.
    Here is insert/save value details:

    Model
    ---------
    public function saveInstituteOfferdCourse($data = array()) {
    if ($this->db->insert('tbl_course_offred', $data)) {
    return $this->db->insert_id(); // tbl_course_offred = "Table name"
    }
    return FALSE;
    }
    ----------
    Controller
    ----------
    public function saveCourses() {
    $data = array();
    $this->load->library('form_validation');
    $this->form_validation->set_rules('skill', 'skill', 'require');
    if ($this->form_validation->run()) {
    $skill = implode(',', $this->input->post('skill'));
    $data['skill'] = $skill;
    $data['user_id'] = $this->session->userdata('user_id');
    $this->user_admin_model->saveInstituteOfferdCourse($data);
    redirect("user_admin_controller/showInsSkills");
    }
    }
    -------
    view
    -------
    <form name="form" method="post" action="tambah">
    <input type="checkbox" name="skill[]" value="PHP" >PHP</input
    <input type="checkbox" name="skill[]" value="VB.NET" >VB.NET</input
    <input type="checkbox" name="skill[]" value="C#" >C#</input
    <input type="submit" value="Submit" />
    </form>
    ................

    I want display value like below site courses.please check the site and give me idea or code.it is very urgent hope anybody help me.
    http://www.yet5.com/training-institu...ndhipuram.html
    please help me master...

    Regards,

  2. #2
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    You might want to double check these names:

    public function saveInstituteOfferdCourse($data = array()) {

    then

    if ($this->db->insert('tbl_course_offred', $data)) {

    If offred / offerd is supposed to be some short hand for offered? Then why not just write it out:

    public function saveInstituteOfferedCourse($data = array()) {

    and

    if ($this->db->insert('tbl_course_offered', $data)) {

    Also,

    $skill = implode(',', $this->input->post('skill'));
    *groan*

    If you are going to be looking up a candidate based on a skill, then you are going to rue the day you decided to keep an array as a comma separated list in a database, the remedy is to read up on database normalization.


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •