Welcome Guest, Not a member yet? Register   Sign In
form_dropdown() return undefined
#2

[eluser]Zied[/eluser]
controller:navigation
function:contact_submit
Code:
function contact_submit() {
        //load form validation
        $this->load->library('form_validation');
    
        //set form rules
        $this->form_validation->set_rules('name', 'name', 'required|max_length[50]');
        $this->form_validation->set_rules('email', 'Email', 'required|min_length[6]|valid_email');
    
        //run form validation
        $success = $this->form_validation->run();
    
        //Test ouput of form_dropdown()  
        echo $subject = $this->input->post('subject');
    
        //if the validation was a success
        if ((IS_AJAX && $success) || (!IS_AJAX && $success))
        {
            $this->load->library('email');
            
            $config['charset'] = 'utf-8';
            $config['mailtype'] = 'html';
            $this->email->initialize($config);
            
            $this->email->set_newline("\r\n");
                
            $this->email->from($this->input->post('email'), $this->input->post('name'));
            $this->email->to('[email protected]');        
            $this->email->subject($this->input->post('subject'));        
            $this->email->message(
            'Le nom de l\'exp&eacute;diteur: '.$this->input->post('name').'<br>'.
            'L\'email de l\'exp&eacute;diteur: '.$this->input->post('email').'<br>'.
            'Type de l\'email: '.$this->input->post('subject').'<br>'.
            'Le m&eacute;ssage: '.$this->input->post('message'));

            if($this->email->send())
            {
                echo 'Your email was sent, fool.';
            }
                
            else
            {
                echo 'Your email was not sent.';
            }
            
        }
    
        //if validation failed
        else { echo '<br>'.strip_tags(validation_errors()); }

    }


Messages In This Thread
form_dropdown() return undefined - by El Forum - 05-13-2010, 05:43 AM
form_dropdown() return undefined - by El Forum - 05-13-2010, 05:53 AM
form_dropdown() return undefined - by El Forum - 05-13-2010, 07:52 AM
form_dropdown() return undefined - by El Forum - 05-13-2010, 08:41 AM
form_dropdown() return undefined - by El Forum - 05-13-2010, 09:04 AM



Theme © iAndrew 2016 - Forum software by © MyBB