Welcome Guest, Not a member yet? Register   Sign In
undefined variable (newbie)
#15

[eluser]jorre[/eluser]
thanks for the reply again, unfortunately my error is still there..

I now changed my code to the following so that $data is available in the main function, and not only in the validation loop, without success:

Code:
function create_step2()
        {
            
            
            $this->load->helper(array('form', 'url'));
            $this->load->library('validation');
            //set validation rules
            $rules['poll_choice1'] = "trim|required";
            $rules['poll_choice2'] = "trim";    
            $this->validation->set_rules($rules);
            
            //set default names for display in error message
            $fields['poll_choice1'] = 'At least one option must be available in any poll';
            $this->validation->set_fields($fields);
                        
            //apply custom error formatting
            $this->validation->set_error_delimiters('<div class="error">', '</div>');
            $this->validation->set_message('required', '%s');
            
            //load data to pass to views
            $data['title'] = "My Real Title";
            $data['heading'] = "My Real Heading";    
            
            
            //run form validation check            
            if($this->validation->run() == FALSE)
            {
                //SHOW STEP 2
                    
                
                $this->load->view('header');        
                $this->load->view('pollcreate_step2',$data, TRUE);    //reload step 2
                $this->load->view('footer');    
            }
            else
            {
                //LOAD THE DATABASE MODEL AND INSERT THE NEW POLL
                $this->load->model('Poll_model','', TRUE);
                $this->Poll_model->add_poll_options();
                
                $this->load->view('header');    
                $this->load->view('messages/poll_success');    //show success message
                $this->load->view('footer');    
            }
                        
        }


Messages In This Thread
undefined variable (newbie) - by El Forum - 02-12-2008, 05:50 PM
undefined variable (newbie) - by El Forum - 02-12-2008, 07:59 PM
undefined variable (newbie) - by El Forum - 02-12-2008, 08:11 PM
undefined variable (newbie) - by El Forum - 02-12-2008, 08:35 PM
undefined variable (newbie) - by El Forum - 02-12-2008, 09:06 PM
undefined variable (newbie) - by El Forum - 02-12-2008, 09:23 PM
undefined variable (newbie) - by El Forum - 02-12-2008, 09:27 PM
undefined variable (newbie) - by El Forum - 02-12-2008, 09:31 PM
undefined variable (newbie) - by El Forum - 02-12-2008, 09:31 PM
undefined variable (newbie) - by El Forum - 02-12-2008, 09:37 PM
undefined variable (newbie) - by El Forum - 02-12-2008, 10:20 PM
undefined variable (newbie) - by El Forum - 02-13-2008, 03:42 AM
undefined variable (newbie) - by El Forum - 02-13-2008, 03:46 AM
undefined variable (newbie) - by El Forum - 02-13-2008, 05:41 AM
undefined variable (newbie) - by El Forum - 02-13-2008, 01:01 PM
undefined variable (newbie) - by El Forum - 02-13-2008, 01:10 PM
undefined variable (newbie) - by El Forum - 03-24-2009, 01:46 AM
undefined variable (newbie) - by El Forum - 03-24-2009, 02:09 AM
undefined variable (newbie) - by El Forum - 03-24-2009, 02:20 AM
undefined variable (newbie) - by El Forum - 03-24-2009, 02:32 AM
undefined variable (newbie) - by El Forum - 03-24-2009, 02:42 AM
undefined variable (newbie) - by El Forum - 07-06-2011, 06:20 AM



Theme © iAndrew 2016 - Forum software by © MyBB