Welcome Guest, Not a member yet? Register   Sign In
Form validation error
#1

(This post was last modified: 07-17-2017, 04:05 AM by gaska96. Edit Reason: I found out what error I had. I named input and submit button same. Beginner mistake. Sorry. Can be deleted. )

EDIT: I found out what error I had. I named input and submit button same. Beginner mistake. Sorry. Can be deleted.

Hi,

I have a function which shows and validate input, but I have a problem with variables after submit ($_POST / $this->input->post() is empty !!!)

This is my function. I have all libraries used inside of this function activated

This is my function. All the time I get the required error. Has anyone an idea ?

PHP Code:
// Check if we have any request
        
if($this->input->post()){
            
// Set delimiters
            
$this->form_validation->set_error_delimiters(
                
'<div class="error_prefix"><i class="fa fa-info-circle"></i> ',
                
'</div>'
            
);

            
$this
                
->form_validation
                
// Validate 'Event code'
                
->set_rules(
                    
'event_code',
                    
'lang:event_code',
                    
'required|trim|min_length[4]|max_length[25]|callback_event_exists',
                    [
                        
'required'               => lang('event_code_required'),
                        
'min_length'             => lang('event_code_min_length'),
                        
'max_length'             => lang('event_code_max_length'),
                        
'event_exists'           => lang('event_code_exists')
                    ]
                );

            
// Check if our form looks good
            
if(false !== $this->form_validation->run()){
                
redirect(base_url('validate/' $this->input->post('event_code')));
            }
        }

 
       // Variables
 
       $this->data['title'               'Mainpage :: ' $this->data['raw_title'];

 
       // Get current language flag
 
       $getCurrentLangFlag $this->language->findBy(['lang_abbr'=>$this->session->userdata('lang')])->row();

 
       $this->data['current_lang_flag'   '<img src="' base_url('public/images/flags/' strtolower($getCurrentLangFlag->lang_flag)) . '" />';
 
       $this->data['languages'           $this->language->findAllBy(['lang_abbr !='=>$this->session->userdata('lang')]);

 
       // Views
        
$this->load->view('main_page'$this->data); 
Reply




Theme © iAndrew 2016 - Forum software by © MyBB