Welcome Guest, Not a member yet? Register   Sign In
Checkbox Values
#5

[eluser]CI_Newb[/eluser]
only including checkboxes since form is rather huge

model
Code:
function add_incident()
    {
        $new_insert_data = array(
            'oe_related' => $this->input->post('oe_related'),    
            'oe_stuckOrder' => $this->input->post('oe_stuckOrder'),    
            'np_failure' => $this->input->post('np_failure')
            );
        
        $insert = $this->db->insert('NS_data', $new_insert_data);
        return $insert;
    }

controller
Code:
function add_incident()
    {
        $this->load->library('form_validation');
        $data['userInfo'] = $this->user_model->find_user();
        
        $this->form_validation->set_rules('oe_related', '');
        $this->form_validation->set_rules('oe_stuckOrder', '');
        $this->form_validation->set_rules('np_failure', '');
        
        if($this->form_validation->run() == FALSE)
        {
            $this->load->model('ns_model');
            $data['tracking_options'] = $this->ns_model->get_ns_tracking();
            $this->load->view('ns/incident_entry_view', $data);
        }
        else
        {            
            $this->load->model('ns_model');
            if($query = $this->ns_model->add_incident())
            {
                redirect('ns/incident_entry');
                //$this->load->view('ns/incident_entry_view', $row);
            }
            else
            {
                $this->load->view('main_menu');            
            }
        }
        
    }

view
Code:
echo form_open('ns/add_incident');

<input type="checkbox" name="oe_related" id="oe_related" value="Y">
<input type="checkbox" name="oe_stuckOrder" id="oe_stuckOrder" value="Y" <?php echo set_checkbox('oe_stuckOrder', 'Y');?> />
<input type="checkbox" name="np_failure" id="np_failure" value="Y" <?php echo set_checkbox('np_failure', 'Y');?> />
</form>


Messages In This Thread
Checkbox Values - by El Forum - 09-28-2010, 05:27 PM
Checkbox Values - by El Forum - 09-28-2010, 09:22 PM
Checkbox Values - by El Forum - 09-28-2010, 09:33 PM
Checkbox Values - by El Forum - 09-28-2010, 09:38 PM
Checkbox Values - by El Forum - 09-28-2010, 09:54 PM
Checkbox Values - by El Forum - 09-28-2010, 10:06 PM
Checkbox Values - by El Forum - 09-28-2010, 10:14 PM
Checkbox Values - by El Forum - 09-28-2010, 10:21 PM
Checkbox Values - by El Forum - 09-29-2010, 02:06 AM
Checkbox Values - by El Forum - 09-29-2010, 07:40 AM
Checkbox Values - by El Forum - 10-02-2010, 03:00 AM



Theme © iAndrew 2016 - Forum software by © MyBB