

    public function form_helper2(){

        $this->load->helper('url');
        $this->load->helper('form');
        $this->load->library('form_validation');
        $this->load->model('model_orders');

        $this->form_validation->set_rules('email','E-mail','required|trim|valid_email|xss_clean');
        $this->form_validation->set_rules('shirt_size','Shirt_size','required|alpha');
        $this->form_validation->set_rules('stripe_choice[]','Stripes','required');
        $this->form_validation->set_rules('terms','Terms and Conditions','callback_accept_terms');
        $this->form_validation->set_rules('free_shipping','Shiping Choice','required|numeric|exact_lenght[1]');



        if($this->form_validation->run() == FALSE){

            $data['title']='Form_Helpers - Part2';
            $data['page_header']='Form_Helper Part2';
            $this->load->view('view_form_helper2',$data);

        }

        else{

            $order_array=array(


                'email'=>$this->input->post('email'),
                'order_time'=>$this->input->post('order_time'),
                'shirt_size'=>$this->input->post('shirt_size'),
                'stripe_choice'=>implode(',',$_POST['stripe_choice']),
                'free_shipping'=>$this->input->post('free_shipping')


            );

            $insert_order=$this->model_orders->insert_order($order_array);
            $data['title']='';
            $data['page_header']='Order Success!';
            $this->load->view('view_form_success',$data);


        }
    }

    public  function accept_terms($value){

        if($value='accept') {

            return TRUE;

        }
        else {

            return FALSE;
        }
    }
