FilterParameters);

        $data['country'] = $this->Setups_model->get_country();
        $data['ethnicity'] = $this->Setups_model->get_ethnicity();
        $data['body_type'] = $this->Setups_model->get_body_type();
        $data['relationship_status'] = $this->Setups_model->get_relationship_status();
        $data['travelling_with'] = $this->Setups_model->get_travelling_with();
        $data['height'] = $this->Setups_model->get_heights();
        $data['education'] = $this->Setups_model->get_education();
        $data['religion'] = $this->Setups_model->get_religion();
        $data['children'] = $this->Setups_model->get_children();
        $data['smoking'] = $this->Setups_model->get_smoking();
        $data['drinking'] = $this->Setups_model->get_drinking();


        $this->load->view('header', $data);
        $this->load->view('left_nav_menu', $data);
        $this->load->view('SgMain/sg_register_part_two_view', $data);
        $this->load->view('footer', $data);
        $this->load->view('footer_close_tags');
    }

    public function register_submit_part_two()
    {
        $data['country'] = $this->Setups_model->get_country();
        $data['ethnicity'] = $this->Setups_model->get_ethnicity();
        $data['body_type'] = $this->Setups_model->get_body_type();
        $data['relationship_status'] = $this->Setups_model->get_relationship_status();
        $data['travelling_with'] = $this->Setups_model->get_travelling_with();
        $data['height'] = $this->Setups_model->get_heights();
        $data['education'] = $this->Setups_model->get_education();
        $data['religion'] = $this->Setups_model->get_religion();
        $data['children'] = $this->Setups_model->get_children();
        $data['smoking'] = $this->Setups_model->get_smoking();
        $data['drinking'] = $this->Setups_model->get_drinking();


        //Mandatory
        $this->form_validation->set_rules("ethnicity", "Ethnicity", "trim|required|callback_combo_check_ethnicity");
        $this->form_validation->set_rules("body_type", "Body Type", "trim|required|callback_combo_check_body_type");
        $this->form_validation->set_rules("relationship_status", "Relationship Status", "trim|required|callback_combo_check_relationship_status");
        $this->form_validation->set_rules("travelling_with", "Travelling With", "trim|required|callback_combo_check_travelling_with");
        $this->form_validation->set_rules("looking_for[]", "Looking For", "trim|required|callback_validate_check_box_options");
        $this->form_validation->set_rules("location", "Location", "trim|required");
        $this->form_validation->set_rules("street_number", "Street Number", "trim");
        $this->form_validation->set_rules("route", "Route", "trim");
        $this->form_validation->set_rules("locality", "Locality", "trim");
        $this->form_validation->set_rules("administrative_area_level_1", "Administrative Area Level 1", "trim");
        $this->form_validation->set_rules("postal_code", "Postal Code", "trim");
        $this->form_validation->set_rules("country", "Country", "trim|required");
        $this->form_validation->set_rules("self_description", "Self Description", "trim|required|min_length[20]");

        //Non mandatory
        $this->form_validation->set_rules("height", "Height", "trim");
        $this->form_validation->set_rules("education", "Education", "trim");
        $this->form_validation->set_rules("religion", "Religion", "trim");
        $this->form_validation->set_rules("children", "Children", "trim");
        $this->form_validation->set_rules("smoking", "Smoking", "trim");
        $this->form_validation->set_rules("drinking", "Drinking", "trim");
        $this->form_validation->set_rules("why_travel", "Why Travel", "trim|min_length[20]");


        if ($this->form_validation->run() == FALSE) {
            //failed validation
            $this->load->view('header');
            $this->load->view('left_nav_menu', $data);
            $this->load->view('SgMain/sg_register_part_two_view', $data);
            $this->load->view('footer', $data);
            $this->load->view('footer_close_tags');
        } else {
            //passed validation
            $s = substr(str_shuffle(str_repeat(defaultRandomStringArray, 6)), 0, 6);
            $userId = 112;
            $lookingFor_options = '';
            for ($x = 0; $x < count($this->input->post('looking_for')); $x++) {
                $looking_for = $this->input->post('looking_for')[$x];
                $lookingFor_options.= $looking_for. ",";
            }
            $data_to_insert = array(
                'ethnicity' => empty_clean_select($this->input->post('ethnicity')),
                'body_type' => empty_clean_select($this->input->post('body_type')),
               'relationship_status' => empty_clean_select($this->input->post('relationship_status')),
                'travelling_with' => empty_clean_select($this->input->post('travelling_with')),
                'looking_for' => $lookingFor_options,
                'location' => $this->input->post('location'),
               'street_number' => $this->input->post('street_number'),
                'route' => $this->input->post('route'),
                'locality' => $this->input->post('locality'),
                'administrative_area_level_1' => $this->input->post('administrative_area_level_1'),
                'postal_code' => (!empty($this->input->post('postal_code')))? ($this->input->post('postal_code')) : 0,
                'country_text' => $this->input->post('country_text'),
               'self_description' => $this->input->post('self_description'),
                'height' => empty_clean_select($this->input->post('height')),
                'education' => empty_clean_select($this->input->post('education')),
               'religion' => empty_clean_select($this->input->post('religion')),
                'children' => empty_clean_select($this->input->post('children')),
               'smoking' => empty_clean_select($this->input->post('smoking')),
                'drinking' => empty_clean_select($this->input->post('drinking')),
                'why_travel' => $this->input->post('why_travel')
            );

            //insert the form data into database
            $this->db->where('tbl_userId', $userId);
            $this->db->update('tbl_users', $data_to_insert);

            //display success message
            $this->session->set_flashdata('msg_sg_register_part_two', '<div class="alert alert-success text-center">Your User Profile has been updated</div>');
            redirect('SgHome/register_form_part_two');
        }
    }

    public function register_submit()
    {
        $data = '';

        //set validations
        $this->form_validation->set_rules("username", "Username", 'trim|required|min_length[5]|max_length[20]|callback_alpha_space_only');
        $this->