Welcome Guest, Not a member yet? Register   Sign In
Getting SQL Results Urgent
#2

Cleaned Up Code A Bit

Code:
function build_thumbnail_responsive()
   {

 
       //set validation rules
       $this->form_validation->set_rules('Name', 'Name', 'required|xss_clean|min_length[3]|max_length[30]');
    $this->form_validation->set_rules('Website', 'Website', 'required|xss_clean|min_length[5]|max_length[30]|callback_Website_check');
       $this->form_validation->set_rules('Style', 'Radio Button', 'required|is_natural|xss_clean|callback_style_check');
    $this->form_validation->set_rules('Layout', 'Radio Button', 'required|is_natural|xss_clean|callback_layout_check');
    $this->form_validation->set_rules('Mlayout', 'Radio Button', 'required|is_natural|xss_clean|callback_Mlayout_check');
       $this->form_validation->set_rules('SelectHeader', 'Select Header', 'required|is_natural|xss_clean|callback_Header_check');
       $this->form_validation->set_rules('SelectTitle', 'Select Title', 'required|is_natural|xss_clean|callback_SelectTitle_check');
     
       
       //validate form input
       if ($this->form_validation->run() == FALSE)
       {
           // fails
    $this->load->view('widget_builder_view');       }
       else
       {
$session_data = $this->session->userdata('logged_in');
$Wid = random_string('alnum', 25);
           //insert the user registration details into database
           $data = array(
            'Userid' => $session_data['id'],
                'enabled_stylesheet' => $this->input->post('Style').$this->input->post('Layout').$this->input->post('Mlayout'),
                'id' => $Wid,
                'Website' => $this->input->post('Website'),
               'Name' => $this->input->post('Name'),
               'Titlechar' => $this->input->post('SelectTitle'),
               'Headertext' => $this->input->post('SelectHeader'),
               'Type' => $this->input->post('Style'),
               'Createddate' => $my_date = date("Y-m-d", time())
           );
           
           // insert form data into database
           if ($this->builder->insertresponsive($data))
           {
               $this->session->set_flashdata('msg','<div class="alert alert-danger text-center">Oops! Error.  Please try again later!!!</div>');

               redirect('widget_install/?id='.$Wid);
           }
           else
           {
               // error
               $this->session->set_flashdata('msg','<div class="alert alert-danger text-center">Oops! Error.  Please try again later!!!</div>');
               redirect('user/register');
           }
       }
 
}
Reply


Messages In This Thread
Getting SQL Results Urgent - by Cablekid - 01-21-2016, 08:28 AM
RE: Getting SQL Results Urgent - by Cablekid - 01-21-2016, 11:19 AM



Theme © iAndrew 2016 - Forum software by © MyBB